@uxland/event-aggregator
Advanced tools
Comparing version 1.0.1-alpha.14 to 1.0.1-alpha.15
@@ -6,2 +6,13 @@ # Change Log | ||
## [1.0.1-alpha.15](https://github.com/uxland/uxland/compare/@uxland/event-aggregator@1.0.1-alpha.14...@uxland/event-aggregator@1.0.1-alpha.15) (2021-06-03) | ||
### Bug Fixes | ||
* correct uglify build ([a182c34](https://github.com/uxland/uxland/commit/a182c34cdd7a79d94c6c6476b7ba12e59fbf1bbe)) | ||
## [1.0.1-alpha.14](https://github.com/uxland/uxland/compare/@uxland/event-aggregator@1.0.1-alpha.13...@uxland/event-aggregator@1.0.1-alpha.14) (2021-06-02) | ||
@@ -8,0 +19,0 @@ |
@@ -1,1 +0,58 @@ | ||
let l=1;l=1,l=1;class o{constructor(t,s){this.messageType=t,this.t=s}i(t){t instanceof this.messageType&&this.t.call(null,t)}}const c=(t,s,e)=>{try{t(s,e)}catch(t){console.error(t)}},b=(t,s)=>{try{t.i(s)}catch(t){console.error(t)}};class p{constructor(){this.o={},this.messageHandlers=[]}h(t,s){let e,i;if(!t)throw new Error("Event channel/type is invalid.");if("string"==typeof t){if(e=this.o[t],e)for(e=e.slice(),i=e.length;i--;)c(e[i],s,t)}else for(e=this.messageHandlers.slice(),i=e.length;i--;)b(e[i],t)}subscribe(t,s){let e,i;if(!t)throw new Error("Event channel/type is invalid.");return i="string"==typeof t?(e=s,this.o[t]||(this.o[t]=[])):(e=new o(t,s),this.messageHandlers),i.push(e),{l(){var t=i.indexOf(e);-1!==t&&i.splice(t,1)}}}u(t,e){const i=this.subscribe(t,(t,s)=>(i.l(),e(t,s)));return i}}const i=new p,d=i.subscribe.bind(i),h=i.u.bind(i),u=i.h.bind(i);export*from"./event-aggregator";export{p as EventAggregator,i as eventAggregator,u as publish,d as subscribe,h as subscribeOnce}; | ||
var o = 1, o = 1; | ||
o = 1; | ||
var l = class { | ||
constructor(s, r) { | ||
this.messageType = s, this.t = r; | ||
} | ||
i(s) { | ||
s instanceof this.messageType && this.t.call(null, s); | ||
} | ||
}, b = (s, r, t) => { | ||
try { | ||
s(r, t); | ||
} catch (s) { | ||
console.error(s); | ||
} | ||
}, p = (s, r) => { | ||
try { | ||
s.i(r); | ||
} catch (s) { | ||
console.error(s); | ||
} | ||
}, c = class { | ||
constructor() { | ||
this.o = {}, this.messageHandlers = []; | ||
} | ||
h(s, r) { | ||
let t, e; | ||
if (!s) throw new Error('Event channel/type is invalid.'); | ||
if ('string' == typeof s) { | ||
if (t = this.o[s], t) for (t = t.slice(), e = t.length; e--; ) b(t[e], r, s); | ||
} else for (t = this.messageHandlers.slice(), e = t.length; e--; ) p(t[e], s); | ||
} | ||
subscribe(s, r) { | ||
let t, e; | ||
if (!s) throw new Error('Event channel/type is invalid.'); | ||
return e = 'string' == typeof s ? (t = r, this.o[s] || (this.o[s] = [])) : (t = new l(s, r), | ||
this.messageHandlers), e.push(t), { | ||
l() { | ||
var s = e.indexOf(t); | ||
-1 !== s && e.splice(s, 1); | ||
} | ||
}; | ||
} | ||
u(s, t) { | ||
let e = this.subscribe(s, (s, r) => (e.l(), t(s, r))); | ||
return e; | ||
} | ||
}, r = new c(), d = r.subscribe.bind(r), h = r.u.bind(r), u = r.h.bind(r); | ||
export { | ||
c as EventAggregator, | ||
r as eventAggregator, | ||
u as publish, | ||
d as subscribe, | ||
h as subscribeOnce | ||
}; |
@@ -0,1 +1,2 @@ | ||
var o=1;o=1;o=1;var l=class{constructor(e,t){this.messageType=e,this.callback=t}handle(e){e instanceof this.messageType&&this.callback.call(null,e)}},b=(i,e,t)=>{try{i(e,t)}catch(s){console.error(s)}},p=(i,e)=>{try{i.handle(e)}catch(t){console.error(t)}},c=class{constructor(){this.eventLookup={},this.messageHandlers=[]}publish(e,t){let s,n;if(!e)throw new Error("Event channel/type is invalid.");if(typeof e=="string"){if(s=this.eventLookup[e],s)for(s=s.slice(),n=s.length;n--;)b(s[n],t,e)}else for(s=this.messageHandlers.slice(),n=s.length;n--;)p(s[n],e)}subscribe(e,t){let s,n;if(!e)throw new Error("Event channel/type is invalid.");return typeof e=="string"?(s=t,n=this.eventLookup[e]||(this.eventLookup[e]=[])):(s=new l(e,t),n=this.messageHandlers),n.push(s),{dispose(){let a=n.indexOf(s);a!==-1&&n.splice(a,1)}}}subscribeOnce(e,t){let s=this.subscribe(e,(n,a)=>(s.dispose(),t(n,a)));return s}},r=new c,d=r.subscribe.bind(r),h=r.subscribeOnce.bind(r),u=r.publish.bind(r);export{c as EventAggregator,r as eventAggregator,u as publish,d as subscribe,h as subscribeOnce}; | ||
/* | ||
@@ -17,2 +18,2 @@ * @license | ||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/export*from"./event-aggregator"; | ||
*/ |
{ | ||
"name": "@uxland/event-aggregator", | ||
"version": "1.0.1-alpha.14", | ||
"version": "1.0.1-alpha.15", | ||
"description": "Event Aggregator", | ||
@@ -33,4 +33,4 @@ "author": "UXLand <dev@uxland.es>", | ||
"build:es": "esbuild *.ts --minify --format=esm --outdir=.", | ||
"prebuild:uglify": "esbuild *.ts --minify --format=esm --outdir=./lib", | ||
"build:uglify": "uglifyjs lib/*.js --compress --mangle --mangle-props --no-annotations -o index.min.js", | ||
"prebuild:uglify": "esbuild index.ts --bundle --minify --external:@uxland/* --format=esm --outdir=./lib", | ||
"build:uglify": "uglifyjs lib/index.js --compress --mangle --mangle-props --no-annotations --beautify quote_style=1 -o index.min.js", | ||
"build": "npm-run-all --parallel build:es build:dts build:uglify", | ||
@@ -81,3 +81,3 @@ "prebuild": "echo nok > .buildstatus", | ||
}, | ||
"gitHead": "1e580754e33ce951c3edfad5560d5ec661a2c25e" | ||
"gitHead": "bd729cc390d3591780ff9b81542856e1abc0bf07" | ||
} |
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
257
27311
10