Mediator.js
Mediator.js copied to clipboard
Support chaining
Have you through of adding chaining to subscribe
, once
and remove
methods?
E.g.
Mediator
.subscribe('channe:one', doOne)
.subscribe('channel:two', doTwo)
.subscribe('channe:three', doThree)
I notice subscribe
and once
return the subscriber
. What is the use case for this?
If this would be a positive change I'd be happy to submit a pull.
I'm currently returning the subscriber so that you can later do things like update priority or options for that specific subscriber without needing a reference to the function (since subscriber returns a guid for reference.)
What do you think about providing a chain()
method, like
Mediator.chain()
.subscribe('channel:one', doOne)
.subscribe('channel:two', doTwo)
Yeah a chain()
would be fine. Good idea.
So, when will you add chaining? :)