1.0.0 • Published 3 years ago
yaeb v1.0.0
yaeb
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();
1.0.0
3 years ago