aerostate
v0.0.3
Published
Async fluent state machine for ES6
Downloads
3
Readme
ES6 async fluent state machine
var data = {progress: []}
var state = new Aerostate('green')
.always(() => console.log('always'))
.when('green').perform(() => console.log('green')).then('yellow')
.when('yellow').perform(() => console.log('yellow')).then('red')
.when('red')
.perform(
() => console.log('red'),
(data, progress) => progress.resolve())
.then('white')
.run(data, data.progress)
.then(data => console.log(data), error => console.log(error));