blockly > Workspace > getBlocksByType
Workspace.getBlocksByType() method
Finds the blocks with the associated type and returns them. Blocks are optionally sorted by position; top to bottom (with slight LTR or RTL bias).
Signature:
getBlocksByType(type: string, ordered: boolean): Block[];
Parameters
Parameter | Type | Description |
---|---|---|
type | string | The type of block to search for. |
ordered | boolean | Sort the list if true. |
Returns:
Block[]
The blocks of the given type.