@coodex/event-bus
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

Event Bus

一个简易的消息总线库,提供两种风格的api。

usage

npm install @coodex/event-bus --save or yarn add @coodex/event-bus

import {EventBus} from '@coodex/event-bus'

const eventBus = new EventBus();

// 订阅
eventBus.on('msg', consumerFunction)
// or
eventBus.topic('msg').subscribe(consumerFunction)

// 发布
eventBus.emit('msg', data)
// or
eventBus.topic('msg').publish(data)

Readme

Keywords

none

Package Sidebar

Install

npm i @coodex/event-bus

Weekly Downloads

1

Version

0.0.1

License

MIT

Unpacked Size

5.09 kB

Total Files

5

Last publish

Collaborators

  • davidoff