Blockly.JavaScript is undefined
See original GitHub issueExpected Behavior
print JavaScript code from blocks
Actual Behavior
Uncaught TypeError: Cannot read property 'workspaceToCode' of undefined
ie. JavaScript property do not exists in Blockly instance
Steps to Reproduce
- git clone
- npm install
- run tests/vertical_playground.html
- press to JavaScript button
Operating System and Browser
Win10, Chrome 64
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Blockly.javascript is undefined - Google Groups
In a react based blockly app am able to add blocks dynamically using: Blockly.JavaScript['some_block_type'] = function () {.... Problem arises ...
Read more >javascript - blocky - property of undefined - Stack Overflow
I am trying to create a custom block in blockly but can't seems ... JavaScript['say_input'] = function(block) { var text_say_input = block.
Read more >Generating and Running JavaScript | Blockly
Advanced methods for evaluating generated JavaScript code.
Read more >How to use the blockly.JavaScript function in blockly - Snyk
To help you get started, we've selected a few blockly.JavaScript examples, based on popular ways it is used in public projects.
Read more >blockly - npm
Blockly is a library for building visual programming editors.. Latest version: 9.2.0, last published: 14 days ago. Start using blockly in ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
You need to import the JavaScript generator to have access to
Blockly.Javascript
This will not allow you to convert the blocks to JavaScript as generators are not being used for scratch-blocks.
Blockly current version of javascript_compressed.js doesn’t work anymore because Blockly.Variables.allUsedVarModels is undefined in scratch-blocks but used in Google Blockly now.
Adding following code before attempting to generate Javascript code from blocks solve the issue:
Also It appears that Blockly.Variables.allUsedVariables is now deprecated in Google Blockly.