blockly > Workspace > getVariableById
Workspace.getVariableById() 方法
v12:使用 Blockly.Workspace.getVariableMap().getVariableById。
根據指定的 ID 找出變數並傳回。如果找不到,則傳回空值。
Signature:
getVariableById(id: string): IVariableModel<IVariableState> | null;
參數
| 參數 | 類型 | 說明 |
|---|---|---|
| id | 字串 | 要檢查的 ID。 |
退貨:
IVariableModel<IVariableState> | null
具有指定 ID 的變數。