Class: Variable

Variable

new Variable(name, value, callback)

Parameters:
Name Type Description
name string The variable name.
value T It's initial value.
callback function Function to call when value is changed.
Source:

Methods

getName() → {string}

Source:
Returns:
The name of the variable.
Type
string

getValue() → {T}

Source:
Returns:
The value of the variable.
Type
T

register(item)

Registers a new item that has this variable.
Parameters:
Name Type Description
item VariableItem The new variable item.
Source:

registerCallback(func)

Registers a callback function with all items associated to this variable.
Parameters:
Name Type Description
func function Callback that does not take any arguments.
Source:

setValue(value)

Sets new variable value. If different from old one it will execute the callback.
Parameters:
Name Type Description
value T New value of the variable.
Source:

unregister(item)

Unregisters an item for this variable.
Parameters:
Name Type Description
item VariableItem The old variable item.
Source:

unregisterCallback(func)

Removes a callback function from all items associated to this variable.
Parameters:
Name Type Description
func function Callback that does not take any arguments.
Source:

update()

Updates the items belonging to the variable.
Source: