blockly

How do I get the total number of blocks in a Blockly workspace


If I have a Blockly workspace, how can I get the total number of blocks that are being used?


Solution

  • workspace.getAllBlocks(false).length

    Docs: https://developers.google.com/blockly/reference/js/Blockly.Workspace#getAllBlocks