Blockly > Demos > Step Execution with JS Interpreter

This is a demo of executing code step-by-step with a sandboxed JavaScript interpreter.

The generator's Blockly.JavaScript.STATEMENT_PREFIX is assigned 'highlightBlock(%1);\n', where %1 is the block id. The call to highlightBlock() will highlight the identified block and set the variable highlightPause to true.

"Parse JavaScript" will generate the code and load it into the interpreter. Then, each press of the "Step JavaScript" button will run the interpreter one step until the highlightPause is true. That is, until highlightBlock() has highlighted the block that will be executed on the next step.

More info on running code with JS Interpreter