Interface ObserverSignalOptions<T>

Options for ObserverSignal.

interface ObserverSignalOptions<T = unknown> {
    equal?: EqualFunction<T>;
    initialValue?: T;
    requireSync?: boolean;
    throttle?: null | number;
    version?: number;
}

Type Parameters

  • T = unknown

Hierarchy (View Summary)

Properties

equal?: EqualFunction<T>

Optional function to compare signal values. Defaults to Object.is().

initialValue?: T

Optional initial value to set when observable does not emit a value synchronously on subscription.

requireSync?: boolean

If set to true (default is false) and no initial value is specified and observable does not emit a value synchronously on subscription then an exception is thrown. Otherwise the signal value type will include undefined as valid value and the signal is initialized to value undefined.

This setting is ignored if an initial value is set.

throttle?: null | number

Optional number of milliseconds to throttle change notifications or null if throttling is disabled (default). This only affects subscribed observers, it does not influence the synchronous retrieval of the signal value via Signal.get.

version?: number

Optional initial signal value version. Defaults to 0. There is usually no need to set this. This option only exists to allow testing the version number wrap in unit tests.