nodejs事件发布/订阅Emitter的使用
by 伍雪颖
var events = require('events'); var emitter = new events.EventEmitter(); emitter.on("event1",function (message) { console.log(message); }); emitter.emit('event1',"I am message");
时间: 2024-10-06 00:28:53
by 伍雪颖
var events = require('events'); var emitter = new events.EventEmitter(); emitter.on("event1",function (message) { console.log(message); }); emitter.emit('event1',"I am message");