Stay organized with collections
Save and categorize content based on your preferences.
blockly > common > getBlockTypeCounts
common.getBlockTypeCounts() function
Get a map of all the block's descendants mapping their type to the number of children with that type.
Signature:
export declare function getBlockTypeCounts(block: Block, opt_stripFollowing?: boolean): {
[key: string]: number;
};
Parameters
Parameter |
Type |
Description |
block |
Block |
The block to map. |
opt_stripFollowing |
boolean |
(Optional) Optionally ignore all following statements (blocks that are not inside a value or statement input of the block). |
Returns:
{ [key: string]: number; }
Map of types to type counts for descendants of the bock.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-18 UTC."],[[["`common.getBlockTypeCounts()` generates a map showing the frequency of each block type within a given block's descendants."],["The function accepts a target block and an optional boolean to exclude following statements from the count."],["The output is a dictionary where keys represent block types and values represent their corresponding counts within the target block's descendants."]]],[]]