Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/varharrie/event-bus-station
:bus: Simple event bus.
https://github.com/varharrie/event-bus-station
Last synced: about 5 hours ago
JSON representation
:bus: Simple event bus.
- Host: GitHub
- URL: https://github.com/varharrie/event-bus-station
- Owner: varHarrie
- License: mit
- Created: 2017-10-24T05:58:16.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2017-11-03T05:22:46.000Z (about 7 years ago)
- Last Synced: 2024-11-19T12:08:01.779Z (about 5 hours ago)
- Language: TypeScript
- Homepage:
- Size: 13.7 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# event-bus-station
Simple event bus.
## Usage
```typescript
import {EventBus} from 'event-bus-station'const bus = new EventBus()
const callback = function (data: any) {
console.log(data)
}bus.once('mount', callback) // single use
bus.on('update', callback)
bus.emit('mount', {a: '1'})
bus.emit('update', {b: '2'})
bus.off('update', callback)
bus.off('update') // remove all listener on 'update'
```