Class DynMapReducerDerived<K, T>
Type Parameters
Index
Constructors
Accessors
Methods
Constructors
constructor
- new
Dyn <K, T>(map, parentIndex, options): DynMapReducerDerived<K, T>Map Reducer Derived Type Parameters
Parameters
- map: DynDataHost<Map<K, T>>
Data host Map.
- parentIndex: DynIndexerAPI<K, T>
Parent indexer.
- options: DynDataOptions<T>
Any filters and sort functions to apply.
Returns DynMapReducerDerived<K, T>
- map: DynDataHost<Map<K, T>>
Accessors
data
- get data(): Map<K, T>
Returns the internal data of this instance. Be careful!
Note: The returned map is the same map set by the main reducer. If any changes are performed to the data externally do invoke DynIndexerAPI.update with
true
to recalculate the index and notify all subscribers.Returns Map<K, T>
The internal data.
derived
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 the Indexer public API.
Returns DynIndexerAPI<K, T>
Indexer API - is also iterable.
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
[iterator]
- [iterator](): IterableIterator<T, any, any>
Provides an iterator for data stored in DerivedMapReducer.
Returns IterableIterator<T, any, any>
destroy
Protected
initialize
- initialize(optionsRest?): void
Protected
Provides a callback for custom derived reducers to initialize any data / custom configuration. This allows child classes to avoid implementing the constructor.
Parameters
Optional
optionsRest: {
[key: string]: any;
}Any additional custom options passed beyond DynDataOptions.
[key: string]: any
Returns void
subscribe
- subscribe(handler): (() => void)
Subscribe to this DerivedMapReducer.
Parameters
- handler: ((value: DynMapReducerDerived<K, T>) => void)
Callback function that is invoked on update / changes. Receives
this
reference.- (value): void
Parameters
- value: DynMapReducerDerived<K, T>
Returns void
Returns (() => void)
Unsubscribe function.
- (): void
Returns void
- handler: ((value: DynMapReducerDerived<K, T>) => void)
Provides the base implementation derived reducer for Maps / DynMapReducer.
Note: That you should never directly create an instance of a derived reducer, but instead use the DynMapReducerDerived.initialize callback to set up any initial state in a custom derived reducer.
Template: K,
T