The known actions. Dispatching a missing action results in an exception.
The stores internal Id. Useful for debugging and referencing.
The current store data. If pulled in a change subscription be aware that multiple mutations may follow and the state is not yet completed.
The state of the store. If not in a dispatch call, its usually Resting. StoreState.
A dispatcher for actions that looks in the actions collection and runs the action if it can find it
The key to initiate the action, must have a corresponding entry in the reducer object
An optional payload that provides data for the action
Returns true for success or false if the action could not dispatch properly (see warnings)
The final event that shows that all mutations of a reducer call are done. Returns the fully mutated store.
A callback function to receive the complete store.
Remove (dispose) all the subscribers for all store states.
A state property, for which you wish to dispose all the subscribers. Can be ommited.
Merge this store with another one. This is useful to have distributed definitions, sub-stores per component actually, but can still work with one single global store - the single source of truth.
Another stores definitions.
Subscribe here for store changes. Don't forget to call remove
on dispose. The subscriber must be destroyed if the defining component is disposed or removed from DOM.
To do so, capture the returned object. It contains a function remove()
you can call, then.
Subscribe to any property of the store defined by store type and only in string form.
The callback that will be called when a change happened. Parameter is the current state object. The callback may not return anything.
Generated using TypeDoc
The store class. You can have multiple stores, even if merged to simplify access different instances exist. The store receives dispatch calls to mutate the store. Each property is handled separately. If one changes through a reducer, the subscriber event fires. This returns the whole store, but only the one property you currently subscribe to has it's new value already; all others remain until they receive their values. That happens even if the reducer returns multiple values in one single step. To assure a fully mutated object