blockly > IVariableMap

IVariableMap 介面

變數對應項目是容器物件,負責儲存及管理工作區參照的變數組合。

任何這些方法都可能定義哪些名稱和類型是合法的不變量,並在未符合這些條件時擲回。

Signature:

export interface IVariableMap<T extends IVariableModel<IVariableState>> 

方法

方法 說明
addVariable(variable)
changeVariableType(variable, newType)
clear()
createVariable(name, id, type) 建立具有指定名稱的新變數。如果未指定 ID,變數對應應建立一個 ID。傳回新變數。
deleteVariable(variable)
getAllVariables()
getTypes() 傳回由此變數對應表所管理的變數類型組合清單。
getVariable(name, type) 傳回具有指定名稱的變數,如果找不到,則傳回空值。如果提供 type,則變數類型也必須相符,否則系統會傳回空值。
getVariableById(id)
getVariablesOfType(type) 傳回此變數對應圖所管理的指定類型變數清單。
renameVariable(variable, newName) 將指定變數的名稱變更為提供的名稱,並傳回已重新命名的變數。