state-registry

0.0.3 • Public • Published

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);

/state-registry/

    Package Sidebar

    Install

    npm i state-registry

    Weekly Downloads

    0

    Version

    0.0.3

    License

    MIT

    Last publish

    Collaborators

    • fgascon