You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
2.4 KiB
1 line
2.4 KiB
!function(r){"use strict";var n={};r.PubSub=n;var t=r.define;!function(a){"use strict";var c={},e=-1;function i(r){var n;for(n in r){if(r.hasOwnProperty(n)){return true}}return false}function o(n){return function r(){throw n}}function f(r,n,t){try{r(n,t)}catch(r){setTimeout(o(r),0)}}function s(r,n,t){r(n,t)}function u(r,n,t,e){var i=c[n],o=e?s:f,u;if(!c.hasOwnProperty(n)){return}for(u in i){if(i.hasOwnProperty(u)){o(i[u],r,t)}}}function p(e,i,o){return function r(){var n=String(e),t=n.lastIndexOf(".");u(e,e,i,o);while(t!==-1){n=n.substr(0,t);t=n.lastIndexOf(".");u(e,n,i,o)}}}function l(r){var n=String(r),t=Boolean(c.hasOwnProperty(n)&&i(c[n])),e=n.lastIndexOf(".");while(!t&&e!==-1){n=n.substr(0,e);e=n.lastIndexOf(".");t=Boolean(c.hasOwnProperty(n)&&i(c[n]))}return t}function t(r,n,t,e){r=typeof r==="symbol"?r.toString():r;var i=p(r,n,e),o=l(r);if(!o){return false}if(t===true){i()}else{setTimeout(i,0)}return true}a.publish=function(r,n){return t(r,n,false,a.immediateExceptions)},a.publishSync=function(r,n){return t(r,n,true,a.immediateExceptions)},a.subscribe=function(r,n){if(typeof n!=="function"){return false}r=typeof r==="symbol"?r.toString():r;if(!c.hasOwnProperty(r)){c[r]={}}var t="uid_"+String(++e);c[r][t]=n;return t},a.subscribeOnce=function(r,n){var t=a.subscribe(r,function(){a.unsubscribe(t);n.apply(this,arguments)});return a},a.clearAllSubscriptions=function r(){c={}},a.clearSubscriptions=function r(n){var t;for(t in c){if(c.hasOwnProperty(t)&&t.indexOf(n)===0){delete c[t]}}},a.countSubscriptions=function r(n){var t;var e=0;for(t in c){if(c.hasOwnProperty(t)&&t.indexOf(n)===0){e++}}return e},a.getSubscriptions=function r(n){var t;var e=[];for(t in c){if(c.hasOwnProperty(t)&&t.indexOf(n)===0){e.push(t)}}return e},a.unsubscribe=function(r){var n=function(r){var n;for(n in c){if(c.hasOwnProperty(n)&&n.indexOf(r)===0){return true}}return false},t=typeof r==="string"&&(c.hasOwnProperty(r)||n(r)),e=!t&&typeof r==="string",i=typeof r==="function",o=false,u,f,s;if(t){a.clearSubscriptions(r);return}for(u in c){if(c.hasOwnProperty(u)){f=c[u];if(e&&f[r]){delete f[r];o=r;break}if(i){for(s in f){if(f.hasOwnProperty(s)&&f[s]===r){delete f[s];o=true}}}}}return o}}(n),"function"==typeof t&&t.amd?t(function(){return n}):"object"==typeof exports&&(void 0!==module&&module.exports&&(exports=module.exports=n),exports.PubSub=n,module.exports=exports=n)}("object"==typeof window&&window||this); |