JSDoc: Class: Variable

# 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:
  - variable.js, line 34

### Methods

#### getName() → {string}

Source:
  - variable.js, line 44

##### Returns:

The name of the variable.

Type
  string

#### getValue() → {T}

Source:
  - variable.js, line 51

##### 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:
  - variable.js, line 79

#### 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:
  - variable.js, line 105

#### 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:
  - variable.js, line 62

#### unregister(item)

Unregisters an item for this variable.

##### Parameters:

Name | Type | Description
--- | --- | ---
`item` | VariableItem | The old variable item.

Source:
  - variable.js, line 88

#### 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:
  - variable.js, line 113

#### update()

Updates the items belonging to the variable.

Source:
  - variable.js, line 97