function nextStep() {
if (myInterpreter.step()) {
window.setTimeout(nextStep, 10);
}
}
Just keep a record of the timeout's process ID:
var pid = 0;function nextStep() {
if (myInterpreter.step()) {
pid = window.setTimeout(nextStep, 10);
}
}
Then whenever you want to terminate the execution, call:window.clearTimeout(pid);
Hello! I wonder if I can create a function that cancels Blockly's step-by-step execution. I'm using JS Interpreter to run custom blocks and it's working perfectly, however, on very long runs, I'd like to cancel execution if possible. How I do a function to cancel the stepInterpreter?
--
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.