Skip to main content

Home > 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

ParameterTypeDescription
blockBlockThe block to map.
opt_stripFollowingboolean(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.