接口 IObservable<T>实验性

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

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

类型参数

  • T

属性

方法

属性

validator?: ObservableValidator<T>

Optional validator that will pre-process the new value.

value: Readonly<T>

Current value of the observable.

方法

  • 实验性

    参数

    • newValue: T

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

    返回 boolean

    Updates the value and notifies dependent objects.