Represents a stateful value that can be observed by different objects.

interface IObservable<T> {
    validator?: ObservableValidator<T>;
    value: Readonly<T>;
    set(newValue: T): boolean;
}

Type Parameters

  • T

Properties

Methods

Properties

validator?: ObservableValidator<T>

Optional validator that will pre-process the new value.

value: Readonly<T>

Current value of the observable.

Methods

  • Parameters

    • newValue: T

      New value to be set (will be processed by the validator if it exists).

    Returns boolean

    Updates the value and notifies dependent objects.