event-messagebus
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

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

Readme

Keywords

Package Sidebar

Install

npm i event-messagebus

Weekly Downloads

1

Version

0.0.1

License

MIT

Unpacked Size

8.85 kB

Total Files

6

Last publish

Collaborators

  • ilex.h