Skip to main content

common

Functions

FunctionDescription
getWorkspaceByIdFind the workspace with the specified ID.
getAllWorkspacesFind all workspaces.
registerWorkspaceRegister a workspace in the workspace db.
unregisterWorkspaceUnregister a workspace from the workspace db.
unregisterWorkpaceUnregister a workspace from the workspace db.
getMainWorkspaceReturns 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.
setMainWorkspaceSets last used main workspace.
getSelectedReturns the current selection.
getParentContainerGet the container element in which to render the WidgetDiv, DropDownDiv and Tooltip.
setParentContainerSet 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.
svgResizeSize 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.
getBlockTypeCountsGet a map of all the block's descendants mapping their type to the number of children with that type.
defineBlocksWithJsonArrayDefine blocks from an array of JSON block definitions, as might be generated by the Blockly Developer Tools.
createBlockDefinitionsFromJsonArrayDefine blocks from an array of JSON block definitions, as might be generated by the Blockly Developer Tools.
defineBlocksAdd the specified block definitions to the block definitions dictionary (Blockly.Blocks).

Variables

VariableDescription
draggingConnectionsAll of the connections on blocks that are currently being dragged.
TEST_ONLY-