1.0.3 • Published 4 years ago

@hellomonday/state v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

@hellomonday/state

A simple module for state management. Add key/value pairs and listen to changes on the key's value.

Install

$ npm install --save @hellomonday/state

Usage

  const CURRENT_SECTION = 'currentSection';
  const state = new State();

  state.on(CURRENT_SECTION, async (state: any) => {
    // The state will return 'current' and 'previous' values
    state.previous.animateOut();
    state.current.animateIn();
  });

  state.setValue(CURRENT_SECTION, new Home());

License

MIT © Hello Monday