@aesoper/eventbus
Advanced tools
Comparing version 1.0.47 to 1.0.57
@@ -6,6 +6,3 @@ (function(global, factory) { | ||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; | ||
var __publicField = (obj, key, value) => { | ||
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); | ||
return value; | ||
}; | ||
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); | ||
@@ -16,5 +13,3 @@ var extendStatics = function(d, b) { | ||
} || function(d2, b2) { | ||
for (var p in b2) | ||
if (Object.prototype.hasOwnProperty.call(b2, p)) | ||
d2[p] = b2[p]; | ||
for (var p in b2) if (Object.prototype.hasOwnProperty.call(b2, p)) d2[p] = b2[p]; | ||
}; | ||
@@ -34,12 +29,9 @@ return extendStatics(d, b); | ||
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; | ||
if (m) | ||
return m.call(o); | ||
if (o && typeof o.length === "number") | ||
return { | ||
next: function() { | ||
if (o && i >= o.length) | ||
o = void 0; | ||
return { value: o && o[i++], done: !o }; | ||
} | ||
}; | ||
if (m) return m.call(o); | ||
if (o && typeof o.length === "number") return { | ||
next: function() { | ||
if (o && i >= o.length) o = void 0; | ||
return { value: o && o[i++], done: !o }; | ||
} | ||
}; | ||
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); | ||
@@ -49,8 +41,6 @@ } | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) | ||
return o; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) | ||
ar.push(r.value); | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} catch (error) { | ||
@@ -60,7 +50,5 @@ e = { error }; | ||
try { | ||
if (r && !r.done && (m = i["return"])) | ||
m.call(i); | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} finally { | ||
if (e) | ||
throw e.error; | ||
if (e) throw e.error; | ||
} | ||
@@ -71,10 +59,8 @@ } | ||
function __spreadArray(to, from, pack) { | ||
if (pack || arguments.length === 2) | ||
for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) | ||
ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) { | ||
if (ar || !(i in from)) { | ||
if (!ar) ar = Array.prototype.slice.call(from, 0, i); | ||
ar[i] = from[i]; | ||
} | ||
} | ||
return to.concat(ar || Array.prototype.slice.call(from)); | ||
@@ -140,7 +126,5 @@ } | ||
try { | ||
if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) | ||
_a.call(_parentage_1); | ||
if (_parentage_1_1 && !_parentage_1_1.done && (_a = _parentage_1.return)) _a.call(_parentage_1); | ||
} finally { | ||
if (e_1) | ||
throw e_1.error; | ||
if (e_1) throw e_1.error; | ||
} | ||
@@ -181,7 +165,5 @@ } | ||
try { | ||
if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) | ||
_b.call(_finalizers_1); | ||
if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1); | ||
} finally { | ||
if (e_2) | ||
throw e_2.error; | ||
if (e_2) throw e_2.error; | ||
} | ||
@@ -306,4 +288,3 @@ } | ||
Subscriber2.prototype.next = function(value) { | ||
if (this.isStopped) | ||
; | ||
if (this.isStopped) ; | ||
else { | ||
@@ -314,4 +295,3 @@ this._next(value); | ||
Subscriber2.prototype.error = function(err) { | ||
if (this.isStopped) | ||
; | ||
if (this.isStopped) ; | ||
else { | ||
@@ -323,4 +303,3 @@ this.isStopped = true; | ||
Subscriber2.prototype.complete = function() { | ||
if (this.isStopped) | ||
; | ||
if (this.isStopped) ; | ||
else { | ||
@@ -650,4 +629,3 @@ this.isStopped = true; | ||
Events.prototype = /* @__PURE__ */ Object.create(null); | ||
if (!new Events().__proto__) | ||
prefix = false; | ||
if (!new Events().__proto__) prefix = false; | ||
} | ||
@@ -664,15 +642,10 @@ function EE(fn, context, once) { | ||
var listener = new EE(fn, context || emitter, once), evt = prefix ? prefix + event : event; | ||
if (!emitter._events[evt]) | ||
emitter._events[evt] = listener, emitter._eventsCount++; | ||
else if (!emitter._events[evt].fn) | ||
emitter._events[evt].push(listener); | ||
else | ||
emitter._events[evt] = [emitter._events[evt], listener]; | ||
if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++; | ||
else if (!emitter._events[evt].fn) emitter._events[evt].push(listener); | ||
else emitter._events[evt] = [emitter._events[evt], listener]; | ||
return emitter; | ||
} | ||
function clearEvent(emitter, evt) { | ||
if (--emitter._eventsCount === 0) | ||
emitter._events = new Events(); | ||
else | ||
delete emitter._events[evt]; | ||
if (--emitter._eventsCount === 0) emitter._events = new Events(); | ||
else delete emitter._events[evt]; | ||
} | ||
@@ -685,7 +658,5 @@ function EventEmitter2() { | ||
var names = [], events, name; | ||
if (this._eventsCount === 0) | ||
return names; | ||
if (this._eventsCount === 0) return names; | ||
for (name in events = this._events) { | ||
if (has.call(events, name)) | ||
names.push(prefix ? name.slice(1) : name); | ||
if (has.call(events, name)) names.push(prefix ? name.slice(1) : name); | ||
} | ||
@@ -699,6 +670,4 @@ if (Object.getOwnPropertySymbols) { | ||
var evt = prefix ? prefix + event : event, handlers = this._events[evt]; | ||
if (!handlers) | ||
return []; | ||
if (handlers.fn) | ||
return [handlers.fn]; | ||
if (!handlers) return []; | ||
if (handlers.fn) return [handlers.fn]; | ||
for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) { | ||
@@ -711,6 +680,4 @@ ee[i] = handlers[i].fn; | ||
var evt = prefix ? prefix + event : event, listeners = this._events[evt]; | ||
if (!listeners) | ||
return 0; | ||
if (listeners.fn) | ||
return 1; | ||
if (!listeners) return 0; | ||
if (listeners.fn) return 1; | ||
return listeners.length; | ||
@@ -720,8 +687,6 @@ }; | ||
var evt = prefix ? prefix + event : event; | ||
if (!this._events[evt]) | ||
return false; | ||
if (!this._events[evt]) return false; | ||
var listeners = this._events[evt], len = arguments.length, args, i; | ||
if (listeners.fn) { | ||
if (listeners.once) | ||
this.removeListener(event, listeners.fn, void 0, true); | ||
if (listeners.once) this.removeListener(event, listeners.fn, void 0, true); | ||
switch (len) { | ||
@@ -748,4 +713,3 @@ case 1: | ||
for (i = 0; i < length; i++) { | ||
if (listeners[i].once) | ||
this.removeListener(event, listeners[i].fn, void 0, true); | ||
if (listeners[i].once) this.removeListener(event, listeners[i].fn, void 0, true); | ||
switch (len) { | ||
@@ -765,6 +729,5 @@ case 1: | ||
default: | ||
if (!args) | ||
for (j = 1, args = new Array(len - 1); j < len; j++) { | ||
args[j - 1] = arguments[j]; | ||
} | ||
if (!args) for (j = 1, args = new Array(len - 1); j < len; j++) { | ||
args[j - 1] = arguments[j]; | ||
} | ||
listeners[i].fn.apply(listeners[i].context, args); | ||
@@ -784,4 +747,3 @@ } | ||
var evt = prefix ? prefix + event : event; | ||
if (!this._events[evt]) | ||
return this; | ||
if (!this._events[evt]) return this; | ||
if (!fn) { | ||
@@ -802,6 +764,4 @@ clearEvent(this, evt); | ||
} | ||
if (events.length) | ||
this._events[evt] = events.length === 1 ? events[0] : events; | ||
else | ||
clearEvent(this, evt); | ||
if (events.length) this._events[evt] = events.length === 1 ? events[0] : events; | ||
else clearEvent(this, evt); | ||
} | ||
@@ -814,4 +774,3 @@ return this; | ||
evt = prefix ? prefix + event : event; | ||
if (this._events[evt]) | ||
clearEvent(this, evt); | ||
if (this._events[evt]) clearEvent(this, evt); | ||
} else { | ||
@@ -818,0 +777,0 @@ this._events = new Events(); |
@@ -1,2 +0,2 @@ | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Eventbus={})}(this,(function(t){"use strict";var e=Object.defineProperty,r=(t,r,n)=>(((t,r,n)=>{r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n})(t,"symbol"!=typeof r?r+"":r,n),n),n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)};function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function i(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function s(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function c(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))}function u(t){return"function"==typeof t}"function"==typeof SuppressedError&&SuppressedError;var a,l=((a=function(t){return function(e){t(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e}}((function(t){Error.call(t),t.stack=(new Error).stack}))).prototype=Object.create(Error.prototype),a.prototype.constructor=a,a);function f(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var p=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}var e;return t.prototype.unsubscribe=function(){var t,e,r,n,o;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var f=i(a),p=f.next();!p.done;p=f.next()){p.value.remove(this)}}catch(e){t={error:e}}finally{try{p&&!p.done&&(e=f.return)&&e.call(f)}finally{if(t)throw t.error}}else a.remove(this);var h=this.initialTeardown;if(u(h))try{h()}catch(t){o=t instanceof l?t.errors:[t]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var b=i(v),d=b.next();!d.done;d=b.next()){var m=d.value;try{y(m)}catch(t){o=null!=o?o:[],t instanceof l?o=c(c([],s(o)),s(t.errors)):o.push(t)}}}catch(t){r={error:t}}finally{try{d&&!d.done&&(n=b.return)&&n.call(b)}finally{if(r)throw r.error}}}if(o)throw new l(o)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)y(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(e)}},t.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},t.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},t.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&f(e,t)},t.prototype.remove=function(e){var r=this._finalizers;r&&f(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=((e=new t).closed=!0,e),t}();function h(t){return t instanceof p||t&&"closed"in t&&u(t.remove)&&u(t.add)&&u(t.unsubscribe)}function y(t){u(t)?t():t.unsubscribe()}p.EMPTY;var v=void 0,b=!1,d={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,c([t,e],s(r)))},clearTimeout:function(t){var e=d.delegate;return((null==e?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function m(){}var _=function(t){function e(e){var r=t.call(this)||this;return r.isStopped=!1,e?(r.destination=e,h(e)&&e.add(r)):r.destination=A,r}return o(e,t),e.create=function(t,e,r){return new S(t,e,r)},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(p),w=Function.prototype.bind;function g(t,e){return w.call(t,e)}var x=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(t){O(t)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(t){O(t)}else O(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){O(t)}},t}(),S=function(t){function e(e,r,n){var o,i,s=t.call(this)||this;u(e)||!e?o={next:null!=e?e:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:s&&b?((i=Object.create(e)).unsubscribe=function(){return s.unsubscribe()},o={next:e.next&&g(e.next,i),error:e.error&&g(e.error,i),complete:e.complete&&g(e.complete,i)}):o=e;return s.destination=new x(o),s}return o(e,t),e}(_);function O(t){var e;e=t,d.setTimeout((function(){throw e}))}var A={closed:!0,next:m,error:function(t){throw t},complete:m},E="function"==typeof Symbol&&Symbol.observable||"@@observable";function P(t){return t}var T=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n,o=this,i=(n=t)&&n instanceof _||function(t){return t&&u(t.next)&&u(t.error)&&u(t.complete)}(n)&&h(n)?t:new S(t,e,r);return function(){var t=o,e=t.operator,r=t.source;i.add(e?e.call(i,r):r?o._subscribe(i):o._trySubscribe(i))}(),i},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},t.prototype.forEach=function(t,e){var r=this;return new(e=j(e))((function(e,n){var o=new S({next:function(e){try{t(e)}catch(t){n(t),o.unsubscribe()}},error:n,complete:e});r.subscribe(o)}))},t.prototype._subscribe=function(t){var e;return null===(e=this.source)||void 0===e?void 0:e.subscribe(t)},t.prototype[E]=function(){return this},t.prototype.pipe=function(){for(var t,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return(0===(t=e).length?P:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)})(this)},t.prototype.toPromise=function(t){var e=this;return new(t=j(t))((function(t,r){var n;e.subscribe((function(t){return n=t}),(function(t){return r(t)}),(function(){return t(n)}))}))},t.create=function(e){return new t(e)},t}();function j(t){var e;return null!==(e=null!=t?t:v)&&void 0!==e?e:Promise}function L(t){return function(e){if(function(t){return u(null==t?void 0:t.lift)}(e))return e.lift((function(e){try{return t(e,this)}catch(t){this.error(t)}}));throw new TypeError("Unable to lift unknown Observable type")}}var B=function(t){function e(e,r,n,o,i,s){var c=t.call(this,e)||this;return c.onFinalize=i,c.shouldUnsubscribe=s,c._next=r?function(t){try{r(t)}catch(t){e.error(t)}}:t.prototype._next,c._error=o?function(t){try{o(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=n?function(){try{n()}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,c}return o(e,t),e.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&(null===(e=this.onFinalize)||void 0===e||e.call(this))}},e}(_);function C(t,e){return L((function(r,n){var o,i,s,c=0;r.subscribe(new B(n,(function(r){return t.call(e,r,c++)&&n.next(r)}),o,i,s))}))}class z{constructor(){r(this,"type"),r(this,"payload"),r(this,"origin"),this.type=this.__proto__.constructor.type}}function k(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var M={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}function o(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function i(t,e,n,i,s){if("function"!=typeof n)throw new TypeError("The listener must be a function");var c=new o(n,i||t,s),u=r?r+e:e;return t._events[u]?t._events[u].fn?t._events[u]=[t._events[u],c]:t._events[u].push(c):(t._events[u]=c,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function c(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),c.prototype.eventNames=function(){var t,n,o=[];if(0===this._eventsCount)return o;for(n in t=this._events)e.call(t,n)&&o.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(t)):o},c.prototype.listeners=function(t){var e=r?r+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,i=n.length,s=new Array(i);o<i;o++)s[o]=n[o].fn;return s},c.prototype.listenerCount=function(t){var e=r?r+t:t,n=this._events[e];return n?n.fn?1:n.length:0},c.prototype.emit=function(t,e,n,o,i,s){var c=r?r+t:t;if(!this._events[c])return!1;var u,a,l=this._events[c],f=arguments.length;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),f){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,n),!0;case 4:return l.fn.call(l.context,e,n,o),!0;case 5:return l.fn.call(l.context,e,n,o,i),!0;case 6:return l.fn.call(l.context,e,n,o,i,s),!0}for(a=1,u=new Array(f-1);a<f;a++)u[a-1]=arguments[a];l.fn.apply(l.context,u)}else{var p,h=l.length;for(a=0;a<h;a++)switch(l[a].once&&this.removeListener(t,l[a].fn,void 0,!0),f){case 1:l[a].fn.call(l[a].context);break;case 2:l[a].fn.call(l[a].context,e);break;case 3:l[a].fn.call(l[a].context,e,n);break;case 4:l[a].fn.call(l[a].context,e,n,o);break;default:if(!u)for(p=1,u=new Array(f-1);p<f;p++)u[p-1]=arguments[p];l[a].fn.apply(l[a].context,u)}}return!0},c.prototype.on=function(t,e,r){return i(this,t,e,r,!1)},c.prototype.once=function(t,e,r){return i(this,t,e,r,!0)},c.prototype.removeListener=function(t,e,n,o){var i=r?r+t:t;if(!this._events[i])return this;if(!e)return s(this,i),this;var c=this._events[i];if(c.fn)c.fn!==e||o&&!c.once||n&&c.context!==n||s(this,i);else{for(var u=0,a=[],l=c.length;u<l;u++)(c[u].fn!==e||o&&!c[u].once||n&&c[u].context!==n)&&a.push(c[u]);a.length?this._events[i]=1===a.length?a[0]:a:s(this,i)}return this},c.prototype.removeAllListeners=function(t){var e;return t?(e=r?r+t:t,this._events[e]&&s(this,e)):(this._events=new n,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t.exports=c}(M);const U=k(M.exports);class F{constructor(t,e,n){r(this,"filterConfig"),this.path=t,this.eventBus=e,this.filterConfig=n??{onlyLocal:!1}}publish(t){t.origin||(t.origin=this),this.eventBus.publish(t)}filter(t){return!this.filterConfig.onlyLocal||t.origin===this}getStream(t){return this.eventBus.getStream(t).pipe(C(this.filter.bind(this)))}subscribe(t,e){return this.getStream(t).subscribe({next:e})}removeAllListeners(){this.eventBus.removeAllListeners()}newScopedBus(t,e){return new F([...this.path,t],this,e)}}t.BusEventBase=z,t.BusEventWithPayload=class extends z{constructor(t){super(),r(this,"payload"),this.payload=t}},t.EventBus=class{constructor(){r(this,"emitter"),r(this,"subscribers",new Map),this.emitter=new U}publish(t){this.emitter.emit(t.type,t)}subscribe(t,e){return this.getStream(t).subscribe({next:e})}getStream(t){return new T((e=>{const r=t=>{e.next(t)};return this.emitter.on(t.type,r),this.subscribers.set(r,e),()=>{this.emitter.off(t.type,r),this.subscribers.delete(r)}}))}newScopedBus(t,e){return new F([t],this,e)}removeAllListeners(){this.emitter.removeAllListeners();for(const[t,e]of this.subscribers)e.complete(),this.subscribers.delete(t)}emit(t,e){"string"==typeof t?this.emitter.emit(t,{type:t,payload:e}):this.emitter.emit(t.name,{type:t.name,payload:e})}on(t,e){e.wrapper=t=>{e(t.payload)},"string"==typeof t?this.emitter.on(t,e.wrapper):this.emitter.on(t.name,e.wrapper)}once(t,e){e.wrapper=t=>{e(t.payload)},"string"==typeof t?this.emitter.once(t,e.wrapper):this.emitter.once(t.name,e.wrapper)}off(t,e){"string"!=typeof t?this.emitter.off(t.name,e.wrapper):this.emitter.off(t,e.wrapper)}},t.createAppEvent=function(t,e){return void 0===e?{name:t}:{name:t,payload:e}},Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})})); | ||
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).Eventbus={})}(this,(function(t){"use strict";var e=Object.defineProperty,r=(t,r,n)=>((t,r,n)=>r in t?e(t,r,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[r]=n)(t,"symbol"!=typeof r?r+"":r,n),n=function(t,e){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])})(t,e)};function o(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");function r(){this.constructor=t}n(t,e),t.prototype=null===e?Object.create(e):(r.prototype=e.prototype,new r)}function i(t){var e="function"==typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"==typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function s(t,e){var r="function"==typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,o,i=r.call(t),s=[];try{for(;(void 0===e||e-- >0)&&!(n=i.next()).done;)s.push(n.value)}catch(t){o={error:t}}finally{try{n&&!n.done&&(r=i.return)&&r.call(i)}finally{if(o)throw o.error}}return s}function c(t,e,r){if(r||2===arguments.length)for(var n,o=0,i=e.length;o<i;o++)!n&&o in e||(n||(n=Array.prototype.slice.call(e,0,o)),n[o]=e[o]);return t.concat(n||Array.prototype.slice.call(e))}function u(t){return"function"==typeof t}"function"==typeof SuppressedError&&SuppressedError;var a,l=((a=function(t){return function(e){t(this),this.message=e?e.length+" errors occurred during unsubscription:\n"+e.map((function(t,e){return e+1+") "+t.toString()})).join("\n "):"",this.name="UnsubscriptionError",this.errors=e}}((function(t){Error.call(t),t.stack=(new Error).stack}))).prototype=Object.create(Error.prototype),a.prototype.constructor=a,a);function f(t,e){if(t){var r=t.indexOf(e);0<=r&&t.splice(r,1)}}var p=function(){function t(t){this.initialTeardown=t,this.closed=!1,this._parentage=null,this._finalizers=null}var e;return t.prototype.unsubscribe=function(){var t,e,r,n,o;if(!this.closed){this.closed=!0;var a=this._parentage;if(a)if(this._parentage=null,Array.isArray(a))try{for(var f=i(a),p=f.next();!p.done;p=f.next()){p.value.remove(this)}}catch(e){t={error:e}}finally{try{p&&!p.done&&(e=f.return)&&e.call(f)}finally{if(t)throw t.error}}else a.remove(this);var h=this.initialTeardown;if(u(h))try{h()}catch(t){o=t instanceof l?t.errors:[t]}var v=this._finalizers;if(v){this._finalizers=null;try{for(var b=i(v),d=b.next();!d.done;d=b.next()){var m=d.value;try{y(m)}catch(t){o=null!=o?o:[],t instanceof l?o=c(c([],s(o)),s(t.errors)):o.push(t)}}}catch(t){r={error:t}}finally{try{d&&!d.done&&(n=b.return)&&n.call(b)}finally{if(r)throw r.error}}}if(o)throw new l(o)}},t.prototype.add=function(e){var r;if(e&&e!==this)if(this.closed)y(e);else{if(e instanceof t){if(e.closed||e._hasParent(this))return;e._addParent(this)}(this._finalizers=null!==(r=this._finalizers)&&void 0!==r?r:[]).push(e)}},t.prototype._hasParent=function(t){var e=this._parentage;return e===t||Array.isArray(e)&&e.includes(t)},t.prototype._addParent=function(t){var e=this._parentage;this._parentage=Array.isArray(e)?(e.push(t),e):e?[e,t]:t},t.prototype._removeParent=function(t){var e=this._parentage;e===t?this._parentage=null:Array.isArray(e)&&f(e,t)},t.prototype.remove=function(e){var r=this._finalizers;r&&f(r,e),e instanceof t&&e._removeParent(this)},t.EMPTY=((e=new t).closed=!0,e),t}();function h(t){return t instanceof p||t&&"closed"in t&&u(t.remove)&&u(t.add)&&u(t.unsubscribe)}function y(t){u(t)?t():t.unsubscribe()}p.EMPTY;var v=void 0,b=!1,d={setTimeout:function(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];return setTimeout.apply(void 0,c([t,e],s(r)))},clearTimeout:function(t){var e=d.delegate;return((null==e?void 0:e.clearTimeout)||clearTimeout)(t)},delegate:void 0};function m(){}var _=function(t){function e(e){var r=t.call(this)||this;return r.isStopped=!1,e?(r.destination=e,h(e)&&e.add(r)):r.destination=A,r}return o(e,t),e.create=function(t,e,r){return new S(t,e,r)},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this),this.destination=null)},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){try{this.destination.error(t)}finally{this.unsubscribe()}},e.prototype._complete=function(){try{this.destination.complete()}finally{this.unsubscribe()}},e}(p),w=Function.prototype.bind;function g(t,e){return w.call(t,e)}var x=function(){function t(t){this.partialObserver=t}return t.prototype.next=function(t){var e=this.partialObserver;if(e.next)try{e.next(t)}catch(t){O(t)}},t.prototype.error=function(t){var e=this.partialObserver;if(e.error)try{e.error(t)}catch(t){O(t)}else O(t)},t.prototype.complete=function(){var t=this.partialObserver;if(t.complete)try{t.complete()}catch(t){O(t)}},t}(),S=function(t){function e(e,r,n){var o,i,s=t.call(this)||this;u(e)||!e?o={next:null!=e?e:void 0,error:null!=r?r:void 0,complete:null!=n?n:void 0}:s&&b?((i=Object.create(e)).unsubscribe=function(){return s.unsubscribe()},o={next:e.next&&g(e.next,i),error:e.error&&g(e.error,i),complete:e.complete&&g(e.complete,i)}):o=e;return s.destination=new x(o),s}return o(e,t),e}(_);function O(t){var e;e=t,d.setTimeout((function(){throw e}))}var A={closed:!0,next:m,error:function(t){throw t},complete:m},E="function"==typeof Symbol&&Symbol.observable||"@@observable";function P(t){return t}var T=function(){function t(t){t&&(this._subscribe=t)}return t.prototype.lift=function(e){var r=new t;return r.source=this,r.operator=e,r},t.prototype.subscribe=function(t,e,r){var n,o=this,i=(n=t)&&n instanceof _||function(t){return t&&u(t.next)&&u(t.error)&&u(t.complete)}(n)&&h(n)?t:new S(t,e,r);return function(){var t=o,e=t.operator,r=t.source;i.add(e?e.call(i,r):r?o._subscribe(i):o._trySubscribe(i))}(),i},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){t.error(e)}},t.prototype.forEach=function(t,e){var r=this;return new(e=j(e))((function(e,n){var o=new S({next:function(e){try{t(e)}catch(t){n(t),o.unsubscribe()}},error:n,complete:e});r.subscribe(o)}))},t.prototype._subscribe=function(t){var e;return null===(e=this.source)||void 0===e?void 0:e.subscribe(t)},t.prototype[E]=function(){return this},t.prototype.pipe=function(){for(var t,e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return(0===(t=e).length?P:1===t.length?t[0]:function(e){return t.reduce((function(t,e){return e(t)}),e)})(this)},t.prototype.toPromise=function(t){var e=this;return new(t=j(t))((function(t,r){var n;e.subscribe((function(t){return n=t}),(function(t){return r(t)}),(function(){return t(n)}))}))},t.create=function(e){return new t(e)},t}();function j(t){var e;return null!==(e=null!=t?t:v)&&void 0!==e?e:Promise}function L(t){return function(e){if(function(t){return u(null==t?void 0:t.lift)}(e))return e.lift((function(e){try{return t(e,this)}catch(t){this.error(t)}}));throw new TypeError("Unable to lift unknown Observable type")}}var B=function(t){function e(e,r,n,o,i,s){var c=t.call(this,e)||this;return c.onFinalize=i,c.shouldUnsubscribe=s,c._next=r?function(t){try{r(t)}catch(t){e.error(t)}}:t.prototype._next,c._error=o?function(t){try{o(t)}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._error,c._complete=n?function(){try{n()}catch(t){e.error(t)}finally{this.unsubscribe()}}:t.prototype._complete,c}return o(e,t),e.prototype.unsubscribe=function(){var e;if(!this.shouldUnsubscribe||this.shouldUnsubscribe()){var r=this.closed;t.prototype.unsubscribe.call(this),!r&&(null===(e=this.onFinalize)||void 0===e||e.call(this))}},e}(_);function C(t,e){return L((function(r,n){var o,i,s,c=0;r.subscribe(new B(n,(function(r){return t.call(e,r,c++)&&n.next(r)}),o,i,s))}))}class z{constructor(){r(this,"type"),r(this,"payload"),r(this,"origin"),this.type=this.__proto__.constructor.type}}function k(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var M={exports:{}};!function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}function o(t,e,r){this.fn=t,this.context=e,this.once=r||!1}function i(t,e,n,i,s){if("function"!=typeof n)throw new TypeError("The listener must be a function");var c=new o(n,i||t,s),u=r?r+e:e;return t._events[u]?t._events[u].fn?t._events[u]=[t._events[u],c]:t._events[u].push(c):(t._events[u]=c,t._eventsCount++),t}function s(t,e){0==--t._eventsCount?t._events=new n:delete t._events[e]}function c(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),(new n).__proto__||(r=!1)),c.prototype.eventNames=function(){var t,n,o=[];if(0===this._eventsCount)return o;for(n in t=this._events)e.call(t,n)&&o.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?o.concat(Object.getOwnPropertySymbols(t)):o},c.prototype.listeners=function(t){var e=r?r+t:t,n=this._events[e];if(!n)return[];if(n.fn)return[n.fn];for(var o=0,i=n.length,s=new Array(i);o<i;o++)s[o]=n[o].fn;return s},c.prototype.listenerCount=function(t){var e=r?r+t:t,n=this._events[e];return n?n.fn?1:n.length:0},c.prototype.emit=function(t,e,n,o,i,s){var c=r?r+t:t;if(!this._events[c])return!1;var u,a,l=this._events[c],f=arguments.length;if(l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),f){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,n),!0;case 4:return l.fn.call(l.context,e,n,o),!0;case 5:return l.fn.call(l.context,e,n,o,i),!0;case 6:return l.fn.call(l.context,e,n,o,i,s),!0}for(a=1,u=new Array(f-1);a<f;a++)u[a-1]=arguments[a];l.fn.apply(l.context,u)}else{var p,h=l.length;for(a=0;a<h;a++)switch(l[a].once&&this.removeListener(t,l[a].fn,void 0,!0),f){case 1:l[a].fn.call(l[a].context);break;case 2:l[a].fn.call(l[a].context,e);break;case 3:l[a].fn.call(l[a].context,e,n);break;case 4:l[a].fn.call(l[a].context,e,n,o);break;default:if(!u)for(p=1,u=new Array(f-1);p<f;p++)u[p-1]=arguments[p];l[a].fn.apply(l[a].context,u)}}return!0},c.prototype.on=function(t,e,r){return i(this,t,e,r,!1)},c.prototype.once=function(t,e,r){return i(this,t,e,r,!0)},c.prototype.removeListener=function(t,e,n,o){var i=r?r+t:t;if(!this._events[i])return this;if(!e)return s(this,i),this;var c=this._events[i];if(c.fn)c.fn!==e||o&&!c.once||n&&c.context!==n||s(this,i);else{for(var u=0,a=[],l=c.length;u<l;u++)(c[u].fn!==e||o&&!c[u].once||n&&c[u].context!==n)&&a.push(c[u]);a.length?this._events[i]=1===a.length?a[0]:a:s(this,i)}return this},c.prototype.removeAllListeners=function(t){var e;return t?(e=r?r+t:t,this._events[e]&&s(this,e)):(this._events=new n,this._eventsCount=0),this},c.prototype.off=c.prototype.removeListener,c.prototype.addListener=c.prototype.on,c.prefixed=r,c.EventEmitter=c,t.exports=c}(M);const U=k(M.exports);class F{constructor(t,e,n){r(this,"filterConfig"),this.path=t,this.eventBus=e,this.filterConfig=n??{onlyLocal:!1}}publish(t){t.origin||(t.origin=this),this.eventBus.publish(t)}filter(t){return!this.filterConfig.onlyLocal||t.origin===this}getStream(t){return this.eventBus.getStream(t).pipe(C(this.filter.bind(this)))}subscribe(t,e){return this.getStream(t).subscribe({next:e})}removeAllListeners(){this.eventBus.removeAllListeners()}newScopedBus(t,e){return new F([...this.path,t],this,e)}}t.BusEventBase=z,t.BusEventWithPayload=class extends z{constructor(t){super(),r(this,"payload"),this.payload=t}},t.EventBus=class{constructor(){r(this,"emitter"),r(this,"subscribers",new Map),this.emitter=new U}publish(t){this.emitter.emit(t.type,t)}subscribe(t,e){return this.getStream(t).subscribe({next:e})}getStream(t){return new T((e=>{const r=t=>{e.next(t)};return this.emitter.on(t.type,r),this.subscribers.set(r,e),()=>{this.emitter.off(t.type,r),this.subscribers.delete(r)}}))}newScopedBus(t,e){return new F([t],this,e)}removeAllListeners(){this.emitter.removeAllListeners();for(const[t,e]of this.subscribers)e.complete(),this.subscribers.delete(t)}emit(t,e){"string"==typeof t?this.emitter.emit(t,{type:t,payload:e}):this.emitter.emit(t.name,{type:t.name,payload:e})}on(t,e){e.wrapper=t=>{e(t.payload)},"string"==typeof t?this.emitter.on(t,e.wrapper):this.emitter.on(t.name,e.wrapper)}once(t,e){e.wrapper=t=>{e(t.payload)},"string"==typeof t?this.emitter.once(t,e.wrapper):this.emitter.once(t.name,e.wrapper)}off(t,e){"string"!=typeof t?this.emitter.off(t.name,e.wrapper):this.emitter.off(t,e.wrapper)}},t.createAppEvent=function(t,e){return void 0===e?{name:t}:{name:t,payload:e}},Object.defineProperty(t,Symbol.toStringTag,{value:"Module"})})); | ||
//# sourceMappingURL=eventbus.min.js.map |
var __defProp = Object.defineProperty; | ||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; | ||
var __publicField = (obj, key, value) => { | ||
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); | ||
return value; | ||
}; | ||
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); | ||
import EventEmitter from "eventemitter3"; | ||
@@ -8,0 +5,0 @@ import { Observable } from "rxjs"; |
var __defProp = Object.defineProperty; | ||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; | ||
var __publicField = (obj, key, value) => { | ||
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); | ||
return value; | ||
}; | ||
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); | ||
import "rxjs"; | ||
@@ -8,0 +5,0 @@ class BusEventBase { |
"use strict"; | ||
var __defProp = Object.defineProperty; | ||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; | ||
var __publicField = (obj, key, value) => { | ||
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); | ||
return value; | ||
}; | ||
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); | ||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); | ||
@@ -9,0 +6,0 @@ const EventEmitter = require("eventemitter3"); |
"use strict"; | ||
var __defProp = Object.defineProperty; | ||
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; | ||
var __publicField = (obj, key, value) => { | ||
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); | ||
return value; | ||
}; | ||
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); | ||
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" }); | ||
@@ -9,0 +6,0 @@ require("rxjs"); |
{ | ||
"name": "@aesoper/eventbus", | ||
"version": "1.0.47", | ||
"version": "1.0.57", | ||
"description": "> TODO: description", | ||
@@ -43,3 +43,3 @@ "homepage": "https://github.com/aesoper101/vue3use#readme", | ||
"dependencies": { | ||
"@aesoper/shared": "^1.1.43", | ||
"@aesoper/shared": "^1.1.53", | ||
"eventemitter3": "^5.0.1", | ||
@@ -49,4 +49,4 @@ "rxjs": "^7.8.1" | ||
"devDependencies": { | ||
"@aesoper/build-cli": "^1.1.30", | ||
"@tsconfig/node18": "^18.2.2", | ||
"@aesoper/build-cli": "^1.2.9", | ||
"@tsconfig/node18": "^18.2.4", | ||
"@vue/tsconfig": "^0.5.1" | ||
@@ -61,5 +61,5 @@ }, | ||
}, | ||
"gitHead": "7824ad823b02ff64b790ba198c4009d509fdb65c", | ||
"gitHead": "f84521a534436e6471385a4fee473e3a9b701568", | ||
"readme": "ERROR: No README data found!", | ||
"_id": "@aesoper/eventbus@1.0.46" | ||
"_id": "@aesoper/eventbus@1.0.51" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
216095
18
1374
Updated@aesoper/shared@^1.1.53