function EventEmitter(){
	this.queue = {};
	this.on = function(e,cb){
		this._add(e,{func:cb});
	};
	this._add = function(e,o){
		if (this.queue[e]) {
			this.queue[e].push(o);
		}else{
			this.queue[e] = [o];
		}
	}
	this.emit = function(e,obj){
		if (this.queue[e] && this.queue[e].length) {
			for (var i=0; i < this.queue[e].length; i++) {
				try{
					this.queue[e][i].func(obj);
				}catch(e){
					
				}
				if (this.queue[e][i].once) {
					this.queue[e].splice(i,1);
				};
			};
		};
	};
	this.once = function(e,cb){
		this._add(e,{func:cb,once:true});
	};
	this.remove = function(e,cb){
		if (!this.queue[e]) return;
		if (!cb) {
			this.queue[e] = null;
			delete this.queue[e];
		}else{
			for (var i=0; i < this.queue[e].length; i++) {
				if (this.queue[e][i].func == cb) {
					this.queue[e].splice(i,1);
					break;
				};
			};
		}
	};
}