Closed ssimeonov closed 7 years ago
You should be able to do this already (see 'State Machine Classes' in the readme)
function MyClass() {
this.startup();
}
StateMachine.create({
target: MyClass.prototype,
events: [
{ name: 'startup', from: 'none', to: 'green' },
{ name: 'panic', from: 'green', to: 'red' },
// ...
]
});
I hope to make this a little easier (and ensure support for es6 syntax) in future v3
Great library!
What do you think about the
create
method being able to add methods to a constructor function and then expose a much simpler/faster instance creation method from that? It would be useful in the cases where an application has to manage many state machines.