Zadbaj o dobrą organizację dzięki kolekcji
Zapisuj i kategoryzuj treści zgodnie ze swoimi preferencjami.
blockly > IVariableMap
Interfejs IVariableMap
Mapy zmiennych to obiekty kontenera odpowiedzialne za przechowywanie zestawu zmiennych, do których odwołuje się obszar roboczy, oraz za zarządzanie nimi.
Każda z tych metod może definiować niezmienniki dotyczące tego, które nazwy i typy są prawidłowe, i wyrzucać wyjątki, jeśli nie są spełnione.
Podpis:
export interface IVariableMap<T extends IVariableModel<IVariableState>>
Metody
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2025-07-25 UTC.
[null,null,["Ostatnia aktualizacja: 2025-07-25 UTC."],[],[],null,["[blockly](./blockly.md) \\\u003e [IVariableMap](./blockly.ivariablemap_interface.md)\n\nIVariableMap interface\n----------------------\n\nVariable maps are container objects responsible for storing and managing the set of variables referenced on a workspace.\n\nAny of these methods may define invariants about which names and types are legal, and throw if they are not met.\n\n**Signature:** \n\n export interface IVariableMap\u003cT extends IVariableModel\u003cIVariableState\u003e\u003e \n\nMethods\n-------\n\n| Method | Description |\n|-------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [addVariable(variable)](./blockly.ivariablemap_interface.addvariable_1_methodsignature.md) | |\n| [changeVariableType(variable, newType)](./blockly.ivariablemap_interface.changevariabletype_1_methodsignature.md) | |\n| [clear()](./blockly.ivariablemap_interface.clear_1_methodsignature.md) | |\n| [createVariable(name, id, type)](./blockly.ivariablemap_interface.createvariable_1_methodsignature.md) | Creates a new variable with the given name. If ID is not specified, the variable map should create one. Returns the new variable. |\n| [deleteVariable(variable)](./blockly.ivariablemap_interface.deletevariable_1_methodsignature.md) | |\n| [getAllVariables()](./blockly.ivariablemap_interface.getallvariables_1_methodsignature.md) | |\n| [getTypes()](./blockly.ivariablemap_interface.gettypes_1_methodsignature.md) | Returns a list of the set of types of the variables managed by this variable map. |\n| [getVariable(name, type)](./blockly.ivariablemap_interface.getvariable_1_methodsignature.md) | Returns the variable with the given name, or null if not found. If `type` is provided, the variable's type must also match, or null should be returned. |\n| [getVariableById(id)](./blockly.ivariablemap_interface.getvariablebyid_1_methodsignature.md) | |\n| [getVariablesOfType(type)](./blockly.ivariablemap_interface.getvariablesoftype_1_methodsignature.md) | Returns a list of all of the variables of the given type managed by this variable map. |\n| [renameVariable(variable, newName)](./blockly.ivariablemap_interface.renamevariable_1_methodsignature.md) | Changes the name of the given variable to the name provided and returns the renamed variable. |"]]