mirror of
https://github.com/vale981/event-pubsub
synced 2025-03-04 17:11:38 -05:00
Better Fix *,* or someEvent,* thanks @hxsf and @conordickinson
This commit is contained in:
parent
aa34d14485
commit
f955b96dd2
3 changed files with 5 additions and 18 deletions
|
@ -22,28 +22,14 @@ window.pubsub=(
|
|||
}
|
||||
checkScope.apply(this);
|
||||
|
||||
if(type=='*'){
|
||||
var params=Array.prototype.slice.call(arguments,1);
|
||||
for(
|
||||
var keys = Object.keys(this._events_),
|
||||
count = keys.length,
|
||||
i=0;
|
||||
i<count;
|
||||
i++
|
||||
){
|
||||
params.unshift(keys[i]);
|
||||
this.off.apply(this,params);
|
||||
}
|
||||
}
|
||||
|
||||
if(!this._events_[type])
|
||||
return;
|
||||
|
||||
if(handler=='*'){
|
||||
delete this._events_[type];
|
||||
return;
|
||||
}
|
||||
|
||||
if(!this._events_[type])
|
||||
return;
|
||||
|
||||
for(var i=0,
|
||||
count=this._events_[type].length;
|
||||
i<count;
|
||||
|
|
|
@ -21,6 +21,7 @@ function unsub(type,handler){
|
|||
|
||||
if(handler=='*'){
|
||||
delete this._events_[type];
|
||||
return;
|
||||
}
|
||||
|
||||
if(!this._events_[type])
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "event-pubsub",
|
||||
"version": "2.1.2",
|
||||
"version": "2.2.0",
|
||||
"description": "Pubsub events for Node and the browser allowing event scoping and multiple scopes. Easy for any developer level. No frills, just high speed pubsub events!",
|
||||
"main": "event-pubsub.js",
|
||||
"directories": {
|
||||
|
|
Loading…
Add table
Reference in a new issue