1.0.0 • Published 3 years ago

yaeb v1.0.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

yaeb build

Yet another event bus. There are many like it, but this one is mine.

The most primitive implementation of a push-based event bus (pub/sub) that you can find.

npm install yaeb
import {EventBus} from 'yaeb';

interface IFooEvent {
  foo: string;
}

const eventBus = new EventBus<IFooEvent>();

const unsubscribe = eventBus.subscribe((event) => console.log(event.foo));

eventBus.publish({foo: 'abc'}); // Outputs "abc" to console

unsubscribe();