Interface MemoSignalConfig<T>

the configuration options used by most primitive derived/computed signal constructors.

interface MemoSignalConfig<T> {
    name?: string;
    equals?: EqualityCheck<T>;
    defer?: boolean;
    value?: T;
}

Type Parameters

  • T

Hierarchy (view full)

Properties

name?: string

give a name to the signal for debugging purposes

equals?: EqualityCheck<T>

when a signal's value is updated (either through a PureSetter, or a change in the value of a dependency signal in the case of a memo), then the dependants/observers of THIS signal will only be notified if the equality check function evaluates to a false.
see EqualityCheck to see its function signature and default behavior when left undefined

defer?: boolean

when false, the computaion/effect function will be be evaluated/run immediately after it is declared.
however, if left undefined, or true, the function's execution will be put off until the reactive signal returned by the createXYZ is called/accessed.
by default, defer is true, and reactivity is not immediately executed during initialization.
the reason why you might want to defer a reactive function is because the body of the reactive function may contain symbols/variables that have not been defined yet, in which case an error will be raised, unless you choose to defer the first execution.

value?: T

initial value declaration for reactive signals.
its purpose is only to be used as a previous value (prev_value) for the optional equals equality function, so that you don't get an undefined as the prev_value on the very first comparison.

Generated using TypeDoc