-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Closed
Labels
component: functionsissue: feature requestDescribes a new feature and why it should be addedDescribes a new feature and why it should be added
Description
Problem Statement
We need a page that we can use to test shared procedures manually (for behaviors that are difficult to unit test). We also need something external developers can play with to show off the new functionality.
Proposed Solution
Create a test page that has two workspaces. The workspaces should have the following toolbox categories:
- Procedures (obvs)
- Variables (so that we can test sharing these as well)
- Some various blocks with different connections (output, input, next, prev, statement) so that we can make stacks.
Then add some code to actually share the procedures between workspaces:
const workspace1 = Blockly.inject('blocklyDiv1', {});
const workspace2 = Blockly.inject('blocklyDiv2', {});
function createChangeListener(otherWs) {
return (e) => {
if (e.type === Blockly.PROCEDURE_CREATE ||
e.type === Blockly.PROCEDURE_DELETE ||
etc...) {
Blockly.Events.fromJson(e.toJson(), otherWs).run(true);
}
}
}
workspace1.addChangeListener(createChangeListener(workspace2));
workspace2.addChangeListener(createChangeListener(workspace1));
Metadata
Metadata
Assignees
Labels
component: functionsissue: feature requestDescribes a new feature and why it should be addedDescribes a new feature and why it should be added