zax-eventbus
TypeScript icon, indicating that this package has built-in type declarations

1.0.2 • Public • Published

Event bus

NPM version Build Status codecov code style: prettier

A subscribe & pubscribe module

Browsers support

IE / EdgeIE / Edge FirefoxFirefox ChromeChrome SafariSafari iOS SafariiOS Safari OperaOpera
IE8+ Edge+ last 10 versions last 10 versions last 2 versions last 2 versions last 2 versions

Install

yarn add zax-eventbus --save

Usage

import EventBus, { EventHandler, EventHandlers, EventOptions, EventSource } from 'zax-eventbus'

const eventbus = new EventBus({
	channel: 'default',
	debug: false
})

eventbus.on('foo', handler)
eventbus.once('qux', handler)
eventbus.emit('foo', 'bar')
eventbus.off('foo')
eventbus.get('foo')
eventbus.has('foo')
eventbus.keys()
eventbus.values()
eventbus.remove('foo')
eventbus.removeAll()

Package Sidebar

Install

npm i zax-eventbus

Weekly Downloads

5

Version

1.0.2

License

MIT

Unpacked Size

52.3 kB

Total Files

39

Last publish

Collaborators

  • jsonchou