Synchronizes tracked values with each other.

Any change to any of the added tracked values would update all the others.

Type Parameters

  • T

Hierarchy

Constructors

Properties

Accessors

Methods

Constructors

Properties

_it: T
_on: EventEmitter<[T, T]> = ...
read: AfterEvent<[T]> = ...

AfterEvent keeper of current value.

The [AfterEvent__symbol] property is an alias of this one.

Returns

Current value keeper.

Accessors

Methods

  • Updates the tracked value by the given value supplier.

    If the value is already updated by another supplier, then unbinds from the old one first.

    Call the byNone method to unbind the tracked value from the source.

    Note that explicitly updating the value would override the value received from the source.

    Parameters

    • supplier: EventSupplier<[T]>

      The source value sender or keeper.

    Returns ValueSync<T>

    this instance.

  • Updates the tracked value by value suppliers extracted from events sent by the given supplier.

    If the value is already updated by another value supplier, then unbinds from the old one first.

    Call the byNone method to unbind the tracked value from the source.

    Note that explicitly updating the value would override the value received from the source.

    Type Parameters

    • TSrcEvent extends any[]

      Source event type.

    Parameters

    • supplier: EventSupplier<TSrcEvent>

      The event supplier to extract value suppliers from.

    • extract: ((this, ...event) => undefined | EventSupplier<[T]>)

      A function extracting value supplier from event received from supplier. May return undefined to suspend receiving values.

        • (this, ...event): undefined | EventSupplier<[T]>
        • Parameters

          • this: void
          • Rest ...event: TSrcEvent

          Returns undefined | EventSupplier<[T]>

    Returns ValueSync<T>

    this instance.

  • Synchronizes the tracked value with the others.

    Applies the value from this sync to the given tracker first.

    Parameters

    Returns Supply

    An event supply. Supply.off Cut it off to break synchronization.

  • Synchronizes the tracked value with the others in the given direction.

    Parameters

    • direction: "in" | "out"

      If set to "in" the value from the given tracker takes precedence over the one in ValueSync. Otherwise the value from the sync is applied to the given tracker first.

    • tracker: ValueTracker<T>

      A value tracker to keep in sync.

    Returns Supply

    An event supply. Supply.off Cut it off to break synchronization.

  • Synchronizes the tracked value with the ones extracted from the events sent by the given supplier.

    Once next value tracker extracted the previous one becomes out of sync.

    Applies the value from this sync to extracted trackers.

    Type Parameters

    • TSrcEvent extends any[]

      A type of supplied events to extract value trackers from.

    Parameters

    • supplier: EventSupplier<TSrcEvent>

      The event supplier to extract value trackers from.

    • extract: ((this, ...event) => undefined | ValueTracker<T>)

      A function extracting the value tracker to keep in sync from the event received from supplier. May return undefined to just break the sync with previous tracker.

        • (this, ...event): undefined | ValueTracker<T>
        • Parameters

          • this: void
          • Rest ...event: TSrcEvent

          Returns undefined | ValueTracker<T>

    Returns Supply

    An event supply. Supply.off Cut it off to break synchronization.

  • Synchronizes the tracked value with the ones extracted from the events sent by the given supplier in the given direction.

    Once next value tracker extracted the previous one becomes out of sync.

    Type Parameters

    • TSrcEvent extends any[]

      A type of supplied events to extract value trackers from.

    Parameters

    • direction: "in" | "out"

      If set to "in" the value from extracted tracker takes precedence over the one in ValueSync. Otherwise the value from the sync is applied to extracted trackers first.

    • supplier: EventSupplier<TSrcEvent>

      The event supplier to extract value trackers from.

    • extract: ((this, ...event) => undefined | ValueTracker<T>)

      A function extracting the value tracker to keep in sync from the event received from supplier. May return undefined to just break the sync with previous tracker.

        • (this, ...event): undefined | ValueTracker<T>
        • Parameters

          • this: void
          • Rest ...event: TSrcEvent

          Returns undefined | ValueTracker<T>

    Returns Supply

    An event supply. Supply.off Cut it off to break synchronization.

Generated using TypeDoc