@igreenearth/events
v1.0.0
Published
events module implement
Downloads
2
Readme
events
NodeJS 中 events 模块的 ES6 实现,请在 ES6 环境中使用。
Install
$ npm install @igreenearth/events --save
Usage
import events from "@igreenearth/events";
var emitter = new events.EventEmitter();
Example
import events from "@igreenearth/events";
var emitter = new events.EventEmitter();
emitter.on("someEvent", function(arg1, arg2) {
console.log("listener1", arg1, arg2);
});
emitter.on("someEvent", function(arg1, arg2) {
console.log("listener2", arg1, arg2);
});
emitter.emit("someEvent", "arg1", "arg2");