Last active
June 5, 2021 13:07
-
-
Save pavi2410/5256c077768ed5add1086c01f88c83a7 to your computer and use it in GitHub Desktop.
Some useful codes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var ws = Blockly.getMainWorkspace() // Get workspace | |
var backpack = Blockly.getMainWorkspace().getBackpack() // get backpack | |
var yail = Blockly.Yail // Access yail generator | |
var repl = Blockly.ReplMgr // Access REPL | |
ws.getAllBlocks // Get all blocks | |
ws.getTopBlocks() // Get top blocks | |
ws.componentDb_ // Get all components | |
ws.formName // Get Form name | |
ws.projectId // Get project id | |
ws.getMetrics() // Get Blockly frame metrics | |
ws.saveBlocksFile() // Get Blockly save file in XML | |
repl.isConnected() // Check companion connection | |
repl.putYail(code) // Run custom YAIL code | |
var selected = Blockly.selected // get current selected block | |
Blockly.Yail.blockToCode1(selected) // generate Yail code | |
var dom = Blockly.Xml.blockToDom(selected, true) // get DOM representation of block | |
var txt = Blockly.Xml.domToText(dom) // convert DOM to text | |
Blockly.Xml.textToDom('<xml>'+txt+'</xml>').firstChild() // convert text to DOM | |
clipboardXml_ // todo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Check whether the user is admin | |
BlocklyPanel_checkIsAdmin() | |
// Get metadata of a component | |
BlocklyPanel_getComponentInfo(String componentName) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment