window.pubsub=( function(){ function sub(type,handler){ checkScope.apply(this); if(!this._events_[type]) this._events_[type]=[]; this._events_[type].push(handler); } function unsub(type,handler){ 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