machina.postal icon indicating copy to clipboard operation
machina.postal copied to clipboard

Dependency injected channels

Open minrwhite opened this issue 10 years ago • 2 comments

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.

minrwhite avatar Jun 27 '14 10:06 minrwhite

Added pull request with unit tested change

minrwhite avatar Jun 30 '14 11:06 minrwhite

@benwhite-deltas hey thanks for submitting this! I'm traveling this week, but will try and get some time to look it over, etc.

ifandelse avatar Jul 01 '14 14:07 ifandelse