Interface DynDerivedReducer<D, K, T>

Defines the interface for a derived reducer.

interface DynDerivedReducer<D, K, T> {
    get data(): D;
    get derived(): DynDerivedAPI<D, K, T>;
    get destroyed(): boolean;
    get filters(): DynAdapterFilters<T>;
    get index(): DynIndexerAPI<K, T>;
    get length(): number;
    reversed: boolean;
    get sort(): DynAdapterSort<T>;
    destroy(): void;
    subscribe(handler: ((value: DynDerivedReducer<D, K, T>) => void)): (() => void);
}

Type Parameters

  • D
  • K
  • T
Implemented by

Accessors

  • get data(): D
  • Returns the internal data of this instance. Be careful!

    Note: if an array is set as initial data then that array is used as the internal data. If any changes are performed to the data externally do invoke update via DynDerivedReducer.index with true to recalculate the index and notify all subscribers.

    Returns D

    The internal data.

  • get destroyed(): boolean
  • Returns whether this derived reducer is destroyed.

    Returns boolean

  • get length(): number
  • Returns number

    Main data / items length or indexed length.

  • get reversed(): boolean
  • Returns boolean

    Gets current reversed state.

  • set reversed(reversed): void
  • Sets reversed state and notifies subscribers.

    Parameters

    • reversed: boolean

      New reversed state.

    Returns void

Methods

  • Removes all derived reducers, subscriptions, and cleans up all resources.

    Returns void

  • Subscribe to this IDerivedReducer.

    Parameters

    • handler: ((value: DynDerivedReducer<D, K, T>) => void)

      Callback function that is invoked on update / changes. Receives derived reducer reference.

    Returns (() => void)

    Unsubscribe function.

      • (): void
      • Returns void