@bodil/signal
    Preparing search index...

    Class State<A>

    A signal which contains a writable value.

    Type Parameters

    • A

    Hierarchy

    • State<A>
      • State

    Implements

    • ISignal<A>

    Properties

    "[NODE]": SignalNode<A>

    Accessors

    • get value(): A

      The current value of the signal.

      When this is read inside a computation function or an effect function, this signal is automatically added to the effect or computed signal as a dependency.

      Returns A

    • set value(value: A): void

      The current value of the signal.

      When this is read inside a computation function or an effect function, this signal is automatically added to the effect or computed signal as a dependency.

      Parameters

      • value: A

      Returns void

    Methods

    • Returns A

    • Subscribe to changes to the value of this signal.

      Parameters

      • callback: (value: A) => void

      Returns Disposable

    • Set the current value of the signal.

      This triggers an update of every dependency of the signal. Computed signals will recompute the next time they're read, and effects will be scheduled to run as soon as possible.

      Parameters

      • value: A

      Returns void

    • Update the current value of this signal using a function.

      Parameters

      • fn: (value: A) => A

      Returns void