astate
v0.0.4
Published
An alternative approach to building apps with JavaScript.
Downloads
2
Readme
aState
aState is a JavaScript library for working with State Machines.
Example
import StateMachine from 'astate'
const state = new StateMachine({
initial: 'off',
off: {
TOGGLE: 'on'
},
on: {
TOGGLE: 'off'
}
})
state.on('statechange', newState => {
console.log(newState.activeState)
})
setInterval(() => {
state.transition('TOGGLE')
}, 1000)