2018-11-15

//引入模块
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);

你可能感兴趣的:(2018-11-15)