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.
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.
[null,null,["Last updated 2024-09-18 UTC."],[[["The `isCapacityAvailable` method checks if a Blockly workspace has enough capacity to create new blocks based on the provided type and count."],["It returns `false` if the total number of blocks or the count of a specific block type exceeds the defined capacity, otherwise it returns `true`."],["The method uses a `typeCountsMap` parameter to specify the types and counts of blocks intended for creation."]]],[]]