标签:extend 事件 ext java world new iat node rip
const EventEmitter = require(‘events‘); class MyEmitter extends EventEmitter {} const myev = new MyEmitter(); myev.on(‘event‘,function(a,b){ console.log(a,b,this); }) myev.emit(‘event‘,"hello","world"); const myEmitter = new MyEmitter(); myEmitter.on(‘event‘, (a, b) => { setImmediate(() => { console.log(a+b+‘这个是异步发生的‘); }); }); myEmitter.emit(‘event‘, ‘a‘, ‘b‘);
标签:extend 事件 ext java world new iat node rip
原文地址:http://www.cnblogs.com/jkklearn/p/7368415.html