Skip to main content

Home > 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

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

Methods

MethodModifiersDescription
getId()
getName()
getType()
getWorkspace()Returns the workspace this VariableModel belongs to.
load(state, workspace)staticLoads 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.