1.0.0 • Published 7 years ago

event-bus-station v1.0.0

Weekly downloads
17
License
MIT
Repository
github
Last release
7 years ago

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'