blockly > VariableModel

VariableModel class

Class for a variable model. Holds information for the variable including name, ID, and type.

Signature:

export declare class VariableModel implements IVariableModel<IVariableState> 

Implements: IVariableModel<IVariableState>

Constructors

Constructor Modifiers Description
(constructor)(workspace, name, opt_type, opt_id) Constructs a new instance of the VariableModel class

Methods

Method Modifiers Description
getId()
getName()
getType()
getWorkspace() Returns the workspace this VariableModel belongs to.
load(state, workspace) static Loads the persisted state into a new variable in the given workspace.
save() Serializes this VariableModel.
setName(newName) Updates the user-visible name of this variable.
setType(newType) Updates the type of this variable.