透過集合功能整理內容
你可以依據偏好儲存及分類內容。
blockly > IVariableMap
IVariableMap 介面
變數對應項目是容器物件,負責儲存及管理工作區參照的變數組合。
任何這些方法都可能定義哪些名稱和類型是合法的不變量,並在未符合這些條件時擲回。
Signature:
export interface IVariableMap<T extends IVariableModel<IVariableState>>
方法
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[],[],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. |"]]