So the documentation is very clear that fixed-size Blockly (i.e., Blockly injected into a div) does not allow for more than one instance per page. I can tell from experimentation that multiple Blockly injections "clobber" each other - last one wins and gets proper event interactions. Why is this the case? Is there an interesting reason why Blockly is designed around this sort of Singleton behavior? Or is it just a development cruft that is relatively unimportant (or perhaps completely unimportant), and so near the bottom of the todo list? If the latter, is there a rough idea of what work would need to be done to isolate Blockly instances?
Blockly.inject(document.getElementById('blocklyDiv'),But it would be nice to also allow this to work:
{toolbox: document.getElementById('toolbox')});
var b1 = new Blockly();
b1.inject(document.getElementById('blocklyDiv1'),
{toolbox: document.getElementById('toolbox1')});
var b2 = new Blockly();
b2.inject(document.getElementById('blocklyDiv2'),
{toolbox: document.getElementById('toolbox2')});
We’re using Blockly in the Virtual World Framework (can be seen here: https://github.com/virtual-world-framework/vwf) with the specific injection code here at line 101: https://github.com/virtual-world-framework/vwf/blob/master/support/client/lib/vwf/view/blockly.js
We use our notion of nodes to allow switching between Blockly toolboxes but we are trying to implement Blockly in a game where a person is able to program multiple mars rovers at the same time to allow them to collaborate.
-Spencer
var w1 = Blockly.inject(document.getElementById('blocklyDiv1'),
{toolbox: document.getElementById('toolbox1')});
var w2 = Blockly.inject(document.getElementById('blocklyDiv2'),
{toolbox: document.getElementById('toolbox2')});
--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+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.