//引入模块
const fs = require("fs");
const events = require("events");
//测试
let eventEmitter = events.EventEmitter;
let event = new eventEmitter();
//注册监听事件
event.on("t1",(arg1,arg2,arg3) => {
console.log("t1:"+arg1+"|"+arg2+"|"+arg3);
});
//触发事件
event.emit("t1",1,2,3);
网友评论