toolish - v0.2.5
    Preparing search index...

    Class ReactiveValue<T>

    Wraps any value, but primarily intended for primitives. There are specialized subclasses for objects and arrays.

    Type Parameters

    • T

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    value: T

    Methods

    • Replaces the underlying value.

      If the new value is strictly equal to the current value, it is ignored. For this and other reasons, ReactiveValue.patch is often more appropriate for non-primitives.

      Parameters

      • value: T

      Returns void

      In case you want to mutate the exising unwrapped value without producing a new one, you're free to do so. Just make sure to manually call Reactive.updateSubscribers afterward to trigger reactive updates.

    • Attempts to perform a partial update of the underlying value based on the differences with the given value. This base implementation just calls ReactiveValue.set but is overridden in subclasses to provide more specialized implementations. Generally, they apply the patch logic recursively to any nested values in the entire graph.

      The main advantages of patch are that resulting reactive updates are reduced to where they're really needed and potentially lower memory overhead due to less unnecessary derivations.

      Parameters

      Returns this