blockly > common

common namespace

Functions

Function Description
createBlockDefinitionsFromJsonArray(jsonArray) Define blocks from an array of JSON block definitions, as might be generated by the Blockly Developer Tools.
defineBlocks(blocks) Add the specified block definitions to the block definitions dictionary (Blockly.Blocks).
defineBlocksWithJsonArray(jsonArray) Define blocks from an array of JSON block definitions, as might be generated by the Blockly Developer Tools.
getAllWorkspaces() Find all workspaces.
getBlockTypeCounts(block, opt_stripFollowing) Get a map of all the block's descendants mapping their type to the number of children with that type.
getMainWorkspace() Returns the last used top level workspace (based on focus). Try not to use this function, particularly if there are multiple Blockly instances on a page.
getParentContainer() Get the container element in which to render the WidgetDiv, DropDownDiv and Tooltip.
getSelected() Returns the currently selected copyable object.
getWorkspaceById(id) Find the workspace with the specified ID.
registerWorkspace(workspace) Register a workspace in the workspace db.
setMainWorkspace(workspace) Sets last used main workspace.
setParentContainer(newParent) Set the parent container. This is the container element that the WidgetDiv, DropDownDiv, and Tooltip are rendered into the first time Blockly.inject is called. This method is a NOP if called after the first Blockly.inject.
svgResize(workspace) Size the SVG image to completely fill its container. Call this when the view actually changes sizes (e.g. on a window resize/device orientation change). See workspace.resizeContents to resize the workspace when the contents change (e.g. when a block is added or removed). Record the height/width of the SVG image.
unregisterWorkpace(workspace) Unregister a workspace from the workspace db.

Variables

Variable Description
draggingConnections All of the connections on blocks that are currently being dragged.
TEST_ONLY