Stay organized with collections
Save and categorize content based on your preferences.
blockly > IVariableMap
IVariableMap interface
Variable maps are container objects responsible for storing and managing the set of variables referenced on a workspace.
Any of these methods may define invariants about which names and types are legal, and throw if they are not met.
Signature:
export interface IVariableMap<T extends IVariableModel<IVariableState>>
Methods
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 2025-05-16 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 2025-05-16 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. |"]]