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) 编辑 收藏 举报