Functions
init ()
object
init (object state
,
array listeners
);
Constructor function
Returns
The public API with state. key
(string|null): The key to get from the state object.
get ()
object
get ();
Passing null or an asterisk will retrieve the entire state object. Passing keys with dot notation will return the corresponding object path. E.g., "bar.foo".
Returns
The cloned object.
set ()
object
set (object object
,
boolean forceDispatch
);
Copies a keyed object back into state, and calls dispatch to fire any connected callbacks.
Returns
The public API for chaining.
exclude ()
object
exclude (array excludeKeys
);
Returns
The public API with filtered state.
trigger ()
any
trigger ();
Fires a callback event for any matching keys in the listener queue. It supports passing through unlimited arguments to the callback. Useful for setting up actions.
Returns
Return result of the callback. actions
(string|array|object): Actions
connect ()
number
connect (function callback
);
Returns
The connection ID to use for later disconnection.
disconnect ()
disconnect (string key
);
Removes a callback listener from the queue.
destroy ()
destroy ();
Assigns undefined to all state properties and listeners. Intended to be used at the end of the application life cycle.