I'm working on an Angular project using Blockly and Phaser but repeat block is not working. Here is a small test to print aa
3 times.
But I received this error:
Here is the code used:
<block type="controls_repeat_ext">
<value name="TIMES">
<shadow type="math_number">
<field name="NUM">3</field>
</shadow>
</value>
</block>
//and for the function
run.on(event.POINTER_DOWN ,(image) => {
eval(document.getElementById('code').innerHTML);
console.log("running" )
});
What should I add to make this repeat work?
i just solved the problem by adding this code:
(Blockly as any).JavaScript.addReservedWords('div2');
var code = (Blockly as any).JavaScript.workspaceToCode();
try {
eval(code);
} catch (e) {
alert(e);
}