Internal
_deadA value describing whether or not the store has been disposed of.
Internal
_subscriberThe subscribers currently registered to the store.
Internal
_subscribersThe subscribers currently registered to the store.
Internal
idA unique ID for the store, to track nested reactive elements to warn the user.
Internal
Sends an event to all subscribers if the store has not been disposed of.
Subscribes the provided function to all store events. This is a convenience method that registers the function for 'change', 'append', 'clear', and 'deletion' events.
A callback function that will be called for all store events
void
Get a deep clone of the current store value.
Added in 4.0.0-rc15 as the recommended way to access store values since the value property is now protected.
A deep clone of the store's current value
Close the store so it no longer sends events.
Add an event listener to the store.
The type of event to listen for. Supported event types include:
update
: Triggered when the store's value is updated via update()
.append
: For ListStore
- Triggered when an item is added to the list.deletion
: For ListStore
/MapStore
- Triggered when an item is removed.change
: For ListStore
/MapStore
: Triggered when an item at an index/key
has its value set via the corresponding store's set() method.A callback function that will be invoked when the specified event occurs.
The function receives a StoreEvent
object with details about the event.
Optional
callNow: trueOptional parameter to immediately trigger the callback with current value
A unique subscriber ID that can be used to unsubscribe the listener.
Removes a specific event listener from the store.
The type of event from which to unsubscribe.
The subscriber ID returned by the on()
method when the listener was registered.
Updates the store's value and notifies all subscribers.
As of 4.0.0-rc15, this method can also accept a transform function that receives the current value and returns a new value.
The updated value, or null if the store has been disposed.
Updates the store's value and notifies all subscribers.
As of 4.0.0-rc15, this method can also accept a transform function that receives the current value and returns a new value.
The new value to set for the store, or a transform function that takes the current value and returns a new value.
The updated value, or null if the store has been disposed.
Static
is
A simple reactive store. Store