1.0.2 • Published 3 years ago

eventcenter-plus v1.0.2

Weekly downloads
2
License
MIT
Repository
-
Last release
3 years ago

#Event Center

The event center is a javascript library to build a global message management in the application which can reduce the coupling between the modules.

#消息中心

消息中心是一个全局的javascript消息管理库,可以通过消息传说来降低系统间的耦合性。消息中心可以在node和浏览器中使用

##使用方法 在node中使用

const EventCenter = require('EventCenter');

...

const unsub = EventCenter.subscribe('message', (data)=>{
    // To handle the message here
    ...
    }
    
//当退出的时候,为了防止内存泄漏,需要调用
unsub(); 


//发送消息的方法

EventCenter.dispatch('message', data);