0.1.4 • Published 5 years ago

simple-js-state v0.1.4

Weekly downloads
3
License
ISC
Repository
github
Last release
5 years ago

State Machine

Based on https://github.com/andybelldesign/beedle which is based on this article https://css-tricks.com/build-a-state-management-system-with-vanilla-javascript/

Publish state change

import store from './store/index.js';

store.dispatch('addItem', 'A new item');

Subscribe to state change

import store from './store/index.js';


constructor() {
    store.subscribe('stateChange', () => this.render());
  }

  render = () => {
    console.log(store.state.items);

    /**
      Compare to local state and update/re-render if necessary
    */
  }
0.1.4

5 years ago

0.1.3

5 years ago

0.1.2

5 years ago

0.1.1

5 years ago

0.1.0

5 years ago