es5 apply fix

This commit is contained in:
SSMP 2016-10-05 23:23:27 -07:00
parent 14bfb2d377
commit bd3c11f85f
3 changed files with 11 additions and 118 deletions

10
es5.js
View file

@ -53,20 +53,20 @@ function EventPubSub() {
}
function emit(type){
this.emit$.apply(this, arguments);
if(!this._events_[type]){
return this;
}
arguments.splice=Array.prototype.splice;
arguments.splice(0,1);
if(!this._events_[type]){
return this.emit$.apply(this, type, arguments);
}
const handlers=this._events_[type];
for(let handler of handlers){
handler.apply(this, arguments);
}
return this.emit$.apply(this, type, arguments);
return this;
}
function emit$(type, args){

View file

@ -53,20 +53,21 @@ window.EventPubSub=function EventPubSub() {
}
function emit(type){
this.emit$.apply(this, arguments);
if(!this._events_[type]){
return this;
}
arguments.splice=Array.prototype.splice;
arguments.splice(0,1);
if(!this._events_[type]){
return emit$.apply(this, type, arguments);
}
const handlers=this._events_[type];
for(let handler of handlers){
handler.apply(this, arguments);
}
return emit$.apply(this, type, arguments);
return this;
}
function emit$(type, args){

File diff suppressed because one or more lines are too long