Variable | context-menu

### Type parameters

- #### T

### Hierarchy

- Variable

## Index

### Constructors

- constructor

### Properties

- callback
- items
- name
- value

### Methods

- getName
- getValue
- register
- registerCallback
- setValue
- unregister
- unregisterCallback
- update

## Constructors

### constructor

- new Variable(name: string, value: T, callback: function): Variable

- - Defined in variable.ts:36
  constructor
  template

    T

  #### Parameters

  - ##### name: string

    The variable name.

  - ##### value: T

    It's initial value.

  - ##### callback: function

    Function to call when value is changed.

    - - (x: T): void

      - #### Parameters

        - ##### x: T

        #### Returns void

  #### Returns Variable

## Properties

### Private callback

callback: function

- Defined in variable.ts:35

#### Type declaration

- - (x: T): void

  - #### Parameters

    - ##### x: T

    #### Returns void

### Private items

items: VariableItem[] = []

- Defined in variable.ts:36

### Private name

name: string = ""

- Defined in variable.ts:33

### Private value

value: T

- Defined in variable.ts:34

## Methods

### getName

- getName(): string

- - Defined in variable.ts:55

  #### Returns string

  The name of the variable.

### getValue

- getValue(): T

- - Defined in variable.ts:62

  #### Returns T

  The value of the variable.

### register

- register(item: VariableItem): void

- - Defined in variable.ts:91

  Registers a new item that has this variable.

  #### Parameters

  - ##### item: VariableItem

    The new variable item.

  #### Returns void

### registerCallback

- registerCallback(func: Function): void

- - Defined in variable.ts:120

  Registers a callback function with all items associated to this variable.

  final

  #### Parameters

  - ##### func: Function

    Callback that does not take any arguments.

  #### Returns void

### setValue

- setValue(value: T): void

- - Defined in variable.ts:74

  Sets new variable value. If different from old one it will execute the callback.

  #### Parameters

  - ##### value: T

    New value of the variable.

  #### Returns void

### unregister

- unregister(item: VariableItem): void

- - Defined in variable.ts:101

  Unregisters an item for this variable.

  #### Parameters

  - ##### item: VariableItem

    The old variable item.

  #### Returns void

### unregisterCallback

- unregisterCallback(func: Function): void

- - Defined in variable.ts:129

  Removes a callback function from all items associated to this variable.

  final

  #### Parameters

  - ##### func: Function

    Callback that does not take any arguments.

  #### Returns void

### update

- update(): void

- - Defined in variable.ts:111

  Updates the items belonging to the variable.

  #### Returns void

Generated using TypeDoc