blockly > Workspace > isCapacityAvailable

Workspace.isCapacityAvailable() method

Check if there is remaining capacity for blocks of the given counts to be created. If the total number of blocks represented by the map is more than the total remaining capacity, it returns false. If a type count is more than the remaining capacity for that type, it returns false.

Signature:

isCapacityAvailable(typeCountsMap: {
        [key: string]: number;
    }): boolean;

Parameters

Parameter Type Description
typeCountsMap { [key: string]: number; } A map of types to counts (usually representing blocks to be created).

Returns:

boolean

True if there is capacity for the given map, false otherwise.