ebus
A high performance event bus, designed as a centralized data flow switchboard in Scrollback. It's in production use both on client and server.
On the client, it serves a similar role as the Flux Dispatcher.
Isn't this PubSub?
It can be used that way, but it does a few more things.
- Subscribers can be triggered in a predetermined sequence or in parallel
- Subscribers can modify the payload before passing it to downstream subscribers
- Subscribers can throw errors to stop propagation to other subscribers
Unlike Flux's Dispatcher, ebus allows multiple events with different subscriber lists, and supports asynchronous subscribers.
Current API
var bus = require("ebus")();bus.on("event", callback, priority);bus.emit("event", data, callback);bus.off("event", callback); // debuggingbus.setDebug(bool); // bus.dump("event"); // logs the listeners in sequence
Proposed API
bus; bus;