blockly > VariableModel

VariableModel 类

变量模型的类。用于存储变量的信息,包括名称、ID 和类型。

Signature:

export declare class VariableModel implements IVariableModel<IVariableState> 

实现IVariableModel<IVariableState>

构造函数

构造函数 修饰符 说明
(constructor)(workspace, name, opt_type, opt_id) 构造 VariableModel 类的新实例

方法

方法 修饰符 说明
getId()
getName()
getType()
getWorkspace() 返回此 VariableModel 所属的工作区。
load(state, workspace) static 将持久化状态加载到给定工作区的新变量中。
save() 序列化此 VariableModel。
setName(newName) 更新此变量的用户可见名称。
setType(newType) 更新此变量的类型。