1.3.1 • Published 3 years ago

jetstate v1.3.1

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

jetstate

NPM

install size dependencies

state managment

install

npm i jetstate --save

use

import { init, state } from 'jetstate';

/**
 * initial new state
 */
init({
  name: 'time',
  defaultValue: new Date().getTime(), 
  willUpdate: (previousValue, nextValue) => {
    console.log('willUpdate', previousValue, nextValue);
  },
  shouldUpdate: (previousValue, nextValue) => {
    if (typeof nextValue 'number') return true;
    else return false        
  },
  didUpdate: value => {
    console.log('didUpdate', value);
  }
});

var time = state.time;

//with this code, willUpdate is run and then didUpdate is run
state.time = new Date().getTime();
1.3.1

3 years ago

1.3.0

5 years ago

1.2.2

5 years ago

1.2.1

5 years ago

1.2.0

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.0

5 years ago

0.0.4

5 years ago