blockly > IVariableMap > getVariable

IVariableMap.getVariable() 方法

返回具有给定名称的变量,如果未找到,则返回 null。如果提供了 type,变量的类型也必须匹配,否则应返回 null。

Signature:

getVariable(name: string, type?: string): T | null;

参数

参数 类型 说明
name 字符串
类型 字符串 (可选)

返回

T | null