// 面试题:实现一个发布订阅,包含on,off,emit,once
// on的时候存起来。emit执行
function EventEmitter(){
this.events={
};
}
EventEmitter.prototype.on = function(type,listener){
if(!this.events[type]){
this.events[type]=[];
}
this.events[type].push(listener);