Hi folks,
Wanted to start experimenting with Blockly, so I added following lines (in the html file of one of my contributions):
<script src="https://blockly-demo.appspot.com/static/blockly_compressed.js"></script>
<script src="https://blockly-demo.appspot.com/static/blocks_compressed.js"></script>
<script src="https://blockly-demo.appspot.com/static/javascript_compressed.js"></script>
<script src="https://blockly-demo.appspot.com/static/demos/code/msg/en.js"></script>
However this resulted in following error:
1. ANALYSIS OF NODE-RED NODE
When I put a breakpoint at the end of the first script (blockly_compressed), seems that there are TWO Blockly variables available:
The first one has scope empty (don't know what this means ...) and second has global scope. Only the first one has a property 'Blocks'.
Then I arrive in the breakpoint at the start of second script (blocks_compressed), where only the global variable Blockly still exists:
At line 4 they want to set the 'colour' of the Blockly.Block property, however an error will occur since that property is undefined.
2. ANALYSIS OF BLOCKLY DEMO
Blockly has provided a demo app, which WORKS FINE so there must be some kind of difference between the demo web app and the Node-Red flow editor.
Again added a breakpoint at the end of the first script, where I see that there is only a SINGLE Blockly variable (containing the Blocks property):
So when we arrive at start of the second script, the Blockly.Blocks is still available as global:
So in the demo app setting the colour (on line 4) will give no error...
3. THE DIFFERENCE ?
I'm now at the point where I'm running out of creativity ;-(
In the first file, the Blockly variable declaration and additiion of a Blocks property seems very natural to me:
Does anybody could point me in some direction? The problem can easily be reproduced by putting the lines into the html file of some node ...
Thanks a lot !!!!!!
Bart