A signal that holds a value from an external source.

Instances of this type are used to integrate "foreign" state into the reactivity system.

interface ExternalReactive<T> {
    value: T;
    peek(): T;
    toJSON(): T;
    toString(): string;
    trigger(): void;
}

Type Parameters

  • T

Hierarchy (View Summary)

Methods

Properties

Methods

  • Accesses the current value without being considered a user of this value.

    Use this method if you do not wish to be notified about changes.

    Returns T

  • Notifies the reactivity system that the external value has changed.

    The users of this value will be notified automatically; if there are any users then the value will be re-computed from its external source using the original callback.

    NOTE: This function is bound to its instance. You can use it directly as an event handler callback without safeguarding this.

    Returns void

Properties

value: T

Accesses the current value stored in this signal.

This access is tracked: users (computed signals, effects, etc.) will be registered as a user of this value and will be notified when it changes.