Interface DynDerivedReducer<D, K, T>
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);
}
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
Implemented by
Accessors
data
- 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 withtrue
to recalculate the index and notify all subscribers.Returns D
The internal data.
derived
- get derived(): DynDerivedAPI<D, K, T>
Returns DynDerivedAPI<D, K, T>
Derived public API.
destroyed
- get destroyed(): boolean
Returns whether this derived reducer is destroyed.
Returns boolean
filters
- get filters(): DynAdapterFilters<T>
Returns DynAdapterFilters<T>
The filters adapter.
index
- get index(): DynIndexerAPI<K, T>
Returns DynIndexerAPI<K, T>
Returns the Indexer public API.
length
- get length(): number
Returns number
Main data / items length or indexed length.
reversed
- 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
- reversed: boolean
sort
- get sort(): DynAdapterSort<T>
Returns DynAdapterSort<T>
The sort adapter.
Methods
destroy
subscribe
- subscribe(handler): (() => 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.
- (value): void
Parameters
- value: DynDerivedReducer<D, K, T>
Returns void
Returns (() => void)
Unsubscribe function.
- (): void
Returns void
- handler: ((value: DynDerivedReducer<D, K, T>) => void)
Defines the interface for a derived reducer.