davestewart / javascript-state-machine

An expressive, feature-rich, event-driven JavaScript finite-state machine
http://statemachine.davestewart.io
343 stars 25 forks source link

Create an `actions` object #17

Open davestewart opened 7 years ago

davestewart commented 7 years ago

Rather than fsm.do('foo') a more expressive syntax would be something like fsm.foo().

However, I don't want to pollute the main StateMachine instance, so what about populating an actions object?

var a = fsm.actions
if(a.next()) {
  a.reset()
}

Should be simple to implement, maybe even as a helper.