To be or not to be.That is a question!

---源于莎士比亚的《哈姆雷特》

导航

node事件发射器

demo:

var events=require('events');
var emitter=new events.EventEmitter();

emitter.on('someEvent',function(arg1,arg2){
    console.log('listener1',arg1,arg2);
})
emitter.on('someEvent',function(arg1,arg2){
    console.log('listener2',arg1,arg2);
})
emitter.emit('someEvent','byvoid',1991);

 

posted on 2013-06-02 10:17  Ijavascript  阅读(159)  评论(0编辑  收藏  举报