blockly > IVariableMap

IVariableMap interface

Variable maps are container objects responsible for storing and managing the set of variables referenced on a workspace.

Any of these methods may define invariants about which names and types are legal, and throw if they are not met.

Signature:

export interface IVariableMap<T extends IVariableModel<IVariableState>> 

Methods

Method Description
addVariable(variable)
changeVariableType(variable, newType)
clear()
createVariable(name, id, type) Creates a new variable with the given name. If ID is not specified, the variable map should create one. Returns the new variable.
deleteVariable(variable)
getAllVariables()
getTypes() Returns a list of the set of types of the variables managed by this variable map.
getVariable(name, type) Returns the variable with the given name, or null if not found. If type is provided, the variable's type must also match, or null should be returned.
getVariableById(id)
getVariablesOfType(type) Returns a list of all of the variables of the given type managed by this variable map.
renameVariable(variable, newName) Changes the name of the given variable to the name provided and returns the renamed variable.