Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/smikhalevski/event-bus
🚌 Yet another event bus. There are many like it, but this one is mine.
https://github.com/smikhalevski/event-bus
event-bus pubsub reactive rx
Last synced: 4 days ago
JSON representation
🚌 Yet another event bus. There are many like it, but this one is mine.
- Host: GitHub
- URL: https://github.com/smikhalevski/event-bus
- Owner: smikhalevski
- License: mit
- Created: 2021-09-18T18:20:21.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2021-12-17T12:40:07.000Z (almost 3 years ago)
- Last Synced: 2024-10-10T21:07:45.316Z (about 1 month ago)
- Topics: event-bus, pubsub, reactive, rx
- Language: TypeScript
- Homepage:
- Size: 98.6 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# event-bus [![build](https://github.com/smikhalevski/event-bus/actions/workflows/master.yml/badge.svg?branch=master&event=push)](https://github.com/smikhalevski/event-bus/actions/workflows/master.yml)
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.
```shell
npm install --save-prod @smikhalevski/event-bus
``````ts
import {EventBus} from '@smikhalevski/event-bus';interface IFooEvent {
foo: string;
}const eventBus = new EventBus();
const unsubscribe = eventBus.subscribe((event) => console.log(event.foo));
eventBus.publish({foo: 'abc'}); // Outputs "abc" to console
unsubscribe();
```