Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

scrollback/ebus

Open more actions menu

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
23 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

  1. Subscribers can be triggered in a predetermined sequence or in parallel
  2. Subscribers can modify the payload before passing it to downstream subscribers
  3. 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);

// debugging
bus.setDebug(bool); // 
bus.dump("event");  // logs the listeners in sequence

Proposed API

bus.on("event", callback).after("target1", "traget2").before("target3");

bus.on("event1 target1> target2> <target3, event2 target3>", callback);

About

A simple, sequential event bus

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Morty Proxy This is a proxified and sanitized view of the page, visit original site.