Blockly Slowly Execution

101 views
Skip to first unread message

whaletalent

unread,
Mar 19, 2017, 4:14:32 PM3/19/17
to Blockly

Hello, I'm having trouble using blockly. My code executes the blocks and is working perfectly though, I would like to control the execution where I could set the time to 1 second on each block. Could you please help me with this problem?

My function Run:

function runCode() {
     
// Generate JavaScript code and run it.
      window
.LoopTrap = 1000;
     
Blockly.JavaScript.INFINITE_LOOP_TRAP =
         
'if (--window.LoopTrap == 0) throw "Infinite loop.";\n';
     
var code = Blockly.JavaScript.workspaceToCode(workspace);
     
Blockly.JavaScript.INFINITE_LOOP_TRAP = null;
     
try {
       
eval(code);
     
} catch (e) {
        alert
(e);
     
}
   
}



Neil Fraser

unread,
Mar 19, 2017, 5:10:17 PM3/19/17
to blo...@googlegroups.com
It allows you to execute your code at any speed (up to 1/1000th of native execution).

--
You received this message because you are subscribed to the Google Groups "Blockly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to blockly+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Reply all
Reply to author
Forward
0 new messages