code-dot-org/blockly — pull request #570 by cpirich (2014-05-09 08:27:49+00:00)
Title: [#70960174] queue all commands

This is a significant change to studio. All commands are now routed through queues to enable deferred execution in what appears to be a 'synchronous' flow. Since we need multiple event handlers to be responsive and we can't block the browser's single javascript thread, the commands in the queue are executed such that they can complete immediately or complete asynchronously. Long-running commands (currently "say" and "moveDistance") will be called repeatedly, but will not be removed from the queue until they are complete, thus delaying the execution of all blocks sequenced after them under a particular event handler. This really helps for the story-telling scenario where you have a pre-defined script and you want to stack all of these blocks under "when story starts".

Previous mechanisms to make "say" and "moveDistance" work asynchronously have been modified or removed, including executionCtx, sayQueues, queuedX/Y, etc.

This work generally fixes block highlighting and opens the door to easily create a "wait" block - coming soon.