Interface RecordMemoSignalConfig<K, V>

the configuration options used by memo record signal constructor RecordMemoSignal.

interface RecordMemoSignalConfig<K, V> {
    name?: string;
    equals?: EqualityCheck<V>;
    defer?: boolean;
    value?: Record<K, V>;
}

Type Parameters

  • K extends PropertyKey
  • V

Hierarchy (view full)

Properties

name?: string

give a name to the signal for debugging purposes

equals?: EqualityCheck<V>

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?: Record<K, V>

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