0.0.1 • Published 1 year ago

@coodex/event-bus v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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)
0.0.1

1 year ago