machina.postal
machina.postal copied to clipboard
Dependency injected channels
I would find it useful if this could be used to pass the input/output channels in to the constructor, rather than having them constructed based on the Fsm namespace.
For example:
myFsm = new machina.Fsm({
handlerBus: postal.channel('myHandlers'),
eventBus: postal.channel('myListeners'),
initialState: 'first',
states: {
// ...
}
}
Does this seem useful? I'd be happy to develop a solution implementing this and submit as a pull request if it does.
Added pull request with unit tested change
@benwhite-deltas hey thanks for submitting this! I'm traveling this week, but will try and get some time to look it over, etc.