mirror of
https://github.com/vale981/event-pubsub
synced 2025-03-04 17:11:38 -05:00
es5 apply fix
This commit is contained in:
parent
14bfb2d377
commit
bd3c11f85f
3 changed files with 11 additions and 118 deletions
10
es5.js
10
es5.js
|
@ -53,20 +53,20 @@ function EventPubSub() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function emit(type){
|
function emit(type){
|
||||||
|
this.emit$.apply(this, arguments);
|
||||||
|
if(!this._events_[type]){
|
||||||
|
return this;
|
||||||
|
}
|
||||||
arguments.splice=Array.prototype.splice;
|
arguments.splice=Array.prototype.splice;
|
||||||
arguments.splice(0,1);
|
arguments.splice(0,1);
|
||||||
|
|
||||||
if(!this._events_[type]){
|
|
||||||
return this.emit$.apply(this, type, arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
const handlers=this._events_[type];
|
const handlers=this._events_[type];
|
||||||
|
|
||||||
for(let handler of handlers){
|
for(let handler of handlers){
|
||||||
handler.apply(this, arguments);
|
handler.apply(this, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.emit$.apply(this, type, arguments);
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
function emit$(type, args){
|
function emit$(type, args){
|
||||||
|
|
|
@ -53,20 +53,21 @@ window.EventPubSub=function EventPubSub() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function emit(type){
|
function emit(type){
|
||||||
|
this.emit$.apply(this, arguments);
|
||||||
|
if(!this._events_[type]){
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
arguments.splice=Array.prototype.splice;
|
arguments.splice=Array.prototype.splice;
|
||||||
arguments.splice(0,1);
|
arguments.splice(0,1);
|
||||||
|
|
||||||
if(!this._events_[type]){
|
|
||||||
return emit$.apply(this, type, arguments);
|
|
||||||
}
|
|
||||||
|
|
||||||
const handlers=this._events_[type];
|
const handlers=this._events_[type];
|
||||||
|
|
||||||
for(let handler of handlers){
|
for(let handler of handlers){
|
||||||
handler.apply(this, arguments);
|
handler.apply(this, arguments);
|
||||||
}
|
}
|
||||||
|
|
||||||
return emit$.apply(this, type, arguments);
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
function emit$(type, args){
|
function emit$(type, args){
|
||||||
|
|
108
npm-debug.log
108
npm-debug.log
File diff suppressed because one or more lines are too long
Loading…
Add table
Reference in a new issue