event-bus-station
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

event-bus-station

Simple event bus.

Usage

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'
 

Readme

Keywords

Package Sidebar

Install

npm i event-bus-station

Weekly Downloads

6

Version

1.0.0

License

MIT

Last publish

Collaborators

  • varharrie