-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsubscribers.core.min.js
More file actions
2 lines (2 loc) · 1.73 KB
/
subscribers.core.min.js
File metadata and controls
2 lines (2 loc) · 1.73 KB
1
2
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).subscribers=e()}(this,(function(){"use strict";const t={},e=(t,e)=>{const r=Object.prototype.hasOwnProperty;return t&&r.call(t,e)},r=r=>e(t,r)&&t[r].length>0,n=(t,e=!0)=>e?r(t):(t=>{let e=r(t),n=t.lastIndexOf(".");for(;!e&&-1!==n;)n=(t=t.substring(0,n)).lastIndexOf("."),e=r(t);return e})(t),o=(e,o,c=!0)=>{const i=e=>{if(!r(e))return!1;t[e].forEach((t=>{const e=(t=>{const e=Object.prototype.toString;return["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]","[object BigInt64Array]","[object BigUint64Array]"].indexOf(e.call(t))>-1})(o)?o.toString():o;t.callback.call(t.context||t,e)}))},l=()=>{let t=e,r=e.lastIndexOf(".");for(;-1!==r;)t=t.substring(0,r),r=t.lastIndexOf("."),i(t);i(e),i("*")};if(!n(e))return!1;c?setTimeout(l,10):l()},c=(()=>{let t=0;return(e="guid-")=>(t+=1,`${e+t}`)})(),i=(e,r,n=null)=>{const o=c();let i="symbol"==typeof e?e.toString():e;return l=r,"[object Function]"===Object.prototype.toString.apply(l)&&(t[i]||(t[i]=[]),t[i].push({topic:i,callback:r,context:n,token:o}),o);var l},l=r=>{if(!e(t,r))return!1;delete t[r]},a=(e,r)=>{if(!n(e))return!1;r?(e=>{const r=Object.keys(t);if(!e||r.length<1)return!1;r.forEach((r=>{const n=t[r];let o;n.forEach(((t,r)=>{t.callback!==e&&t.token!==e||(o=t.topic,n.splice(-1,r))})),n.length<1&&l(o)}))})(r):l(e)};return{on:(t,e)=>i(t,e),emit(t,e,r=!0){return o(t,e,r),this},off(t,e){return a(t,e),this}}}));
//# sourceMappingURL=subscribers.core.min.js.map