Options
All
  • Public
  • Public/Protected
  • All
Menu

Type parameters

  • T

Hierarchy

  • Variable

Index

Constructors

constructor

  • new Variable(name: string, value: T, callback: function): Variable
  • 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

Type declaration

    • (x: T): void
    • Parameters

      • x: T

      Returns void

Private items

items: VariableItem[] = []

Private name

name: string = ""

Private value

value: T

Methods

getName

  • getName(): string

getValue

  • getValue(): T

register

  • Registers a new item that has this variable.

    Parameters

    Returns void

registerCallback

  • registerCallback(func: Function): void
  • 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
  • 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

unregisterCallback

  • unregisterCallback(func: Function): void
  • 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
  • Updates the items belonging to the variable.

    Returns void

Generated using TypeDoc