Class TrieSearchQuery<T>
Type Parameters
- T extends object
Hierarchy
- DynArrayReducer<T>
- TrieSearchQuery (View Summary)
Constructors
constructor
-
new TrieSearchQuery<T extends object>(
trieSearch: TrieSearch<T>,
options?: TrieSearchQueryOptions<T>,
): TrieSearchQuery<T>Type Parameters
- T extends object
Parameters
- trieSearch: TrieSearch<T>
The associated TrieSearch instance.
Optionaloptions: TrieSearchQueryOptions<T>Optional query settings.
Returns TrieSearchQuery<T>
Accessors
data
-
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
updatevia DynArrayReducer.index withtrueto recalculate the index and notify all subscribers.Returns T[]
The internal data.
derived
-
Returns DynReducer.API.DerivedList<T>
Derived public API.
destroyed
-
get destroyed(): boolean
Returns boolean
Returns whether this instance is destroyed.
filters
index
-
Returns Index<number>
Returns the Indexer public API; is also iterable.
isDestroyed
-
get isDestroyed(): boolean
Returns boolean
The current destroyed state of this query instance.
length
-
get length(): number
Returns number
Returns the main data items or indexed items length.
limit
-
Returns Writable<number>
The writable store controlling the search results limit.
query
reversed
-
get reversed(): boolean
Returns boolean
Returns current reversed state.
-
set reversed(reversed: boolean): void
Sets reversed state and notifies subscribers.
Parameters
- reversed: boolean
New reversed state.
Returns void
- reversed: boolean
sort
-
Returns DynReducer.API.Sort<T>
The sort adapter.
trieReducer
-
Returns TrieSearchReducer<T>
Any associated TrieSearch reducer function.
-
Parameters
- trieReducer: TrieSearchReducer<T>
A new trie reducer function.
Returns void
- trieReducer: TrieSearchReducer<T>
trieSearch
-
Returns TrieSearch<T>
The associated TrieSearch instance; can be undefined.
Methods
[iterator]
-
Provides an iterator for data stored in DynArrayReducer.
Returns IterableIterator<T>
Iterator for data stored in DynArrayReducer.
destroy
-
Destroys and disconnects this query from the local stores and any associated TrieSearch instance.
Returns void
Protectedinitialize
-
ProtectedProvides a callback for custom reducers to initialize any data / custom configuration. Depending on the consumer of
dynamic-reducerthis may be utilized allowing child classes to avoid implementing the constructor.Parameters
OptionaloptionsRest: { [key: string]: any }Any additional custom options passed beyond DynReducer.Options.Common.
Returns void
setData
subscribe
-
Add a subscriber to this DynArrayReducer instance.
Parameters
- handler: (value: this) => void
Callback function that is invoked on update / changes. Receives
thisreference.
Returns () => void
Unsubscribe function.
- handler: (value: this) => void
Provides a reactive query interface to TrieSearch in addition to dynamic filtering / sorting of search results.