event-messagebus
v0.0.1
Published
event messagebus
Downloads
2
Readme
MessageBus
event message bus
usage
import MessageBus from 'event-messagebus';
const msgBus = new MessageBus('demobus');
// 发布消息
msgBus.publish('add', { name: 'ilex' });
// 单个订阅消息
msgBus.subscribe('add', (data) => {
console.log(data);
});
// 订阅多个消息
msgBus.subscribe(['add', 'see'], (data) => {
console.log(data);
});
author
ilex.h
License
MIT