Interface Observable<V>

An object containing a value which can be efficiently watched for changes.

interface Observable<V> {
    get value(): V;
    unwatch(callback: ObservableCallback<V>): this;
    watch(callback: ObservableCallback<V>, callNow?: boolean, group?: unknown): this;
}

Type Parameters

  • V

Hierarchy (view full)

Implemented by

Accessors

Methods

Accessors

Methods

  • Register a callback to this observable. When the value is changed, the callback will be called.

    Parameters

    • callback: ObservableCallback<V>
    • OptionalcallNow: boolean

      If true, the callback will be called once immediately after it's registered. False by default

    • Optionalgroup: unknown

      The group to use when calling immediately. Only used if callNow is true, and is undefined by default

    Returns this