state-registry

Immutable application state registry


Keywords
state, immutable
License
MIT
Install
npm install state-registry@0.0.3

Documentation

state-registry

Immutable application state registry

API

const appState = new StateRegistry(initialState)

Add a change to the list of pending changes. See https://github.com/kolodny/immutability-helper for details.

appState.update(changeSet);

Perform all pending changes.

appState.commitChanges();

Add some changes and commit right away. This is the same as calling update() then commitChanges().

appState.updateAndCommit(changeSet);

Listen for state changes. The listener receive the new state as first argument and the old state as second argument.

appState.addChangeListener(listener);

Remove a change listener.

appState.removeChangeListener(listener);

Extend the update functionalities. See https://github.com/kolodny/immutability-helper for details.

appState.extendUpdate(directive, fnc);