fistpro
Version:
26 lines (15 loc) • 438 B
JavaScript
var events=require('events');
var ab=new events.EventEmitter();
ab.on('first1',function(data){
console.log('new:'+data);
});
ab.on('find',function(data){
console.log('oo:'+data);
});
ab.on('SecondEvent',function(data){
console.log('Second Scriber:'+data);
});
ab.emit('first1','hello world');
ab.emit('find','heelo world');
ab.emit('SecondEvent',"這是第二個監聽式!");
//ab.emit('first3','yyy');