@live-change/dao-message
Advanced tools
Comparing version 0.5.16 to 0.5.17
22
index.js
@@ -12,3 +12,3 @@ const rd = require("@live-change/dao") | ||
this.messageChannel = settings.messageChannel ? new MessageChannel() : null | ||
this.port = this.messageChannel ? this.messageChannel.port1 : this.target | ||
this.port = settings.messagePort ?? (this.messageChannel ? this.messageChannel.port1 : this.target) | ||
this.decorator = settings.decorator || ((message) => message) | ||
@@ -26,13 +26,17 @@ this.filter = settings.filter || ((message) => true) | ||
}) | ||
this.target.addEventListener('error', (event) => { | ||
console.error("Worker", this.url, "error", event) | ||
}) | ||
this.port.addEventListener('messageerror', (event) => { | ||
console.error("Worker", this.url, "message error", event) | ||
}) | ||
this.target.addEventListener('unhandledrejection', (event) => { | ||
console.error("Worker", this.url, "unhandled rejection", event) | ||
}) | ||
if(this.target?.addEventListener) { | ||
this.target.addEventListener('error', (event) => { | ||
console.error("Worker", this.url, "error", event) | ||
}) | ||
this.target.addEventListener('unhandledrejection', (event) => { | ||
console.error("Worker", this.url, "unhandled rejection", event) | ||
}) | ||
} | ||
if(this.port.start) { | ||
this.port.start() | ||
} | ||
if(this.messageChannel) { | ||
this.port.start() | ||
this.target.postMessage({ type: 'connection', port: this.messageChannel.port2 }, [this.messageChannel.port2]) | ||
@@ -59,3 +63,3 @@ } | ||
} else { | ||
if (this.target.terminate) this.target.terminate() | ||
if (this.target?.terminate) this.target.terminate() | ||
} | ||
@@ -62,0 +66,0 @@ } |
{ | ||
"name": "@live-change/dao-message", | ||
"version": "0.5.16", | ||
"version": "0.5.17", | ||
"author": { | ||
@@ -13,3 +13,3 @@ "email": "m8@em8.pl", | ||
"dependencies": { | ||
"@live-change/dao": "^0.5.16", | ||
"@live-change/dao": "^0.5.17", | ||
"debug": "^4.3.4", | ||
@@ -45,3 +45,3 @@ "supports-color": "^7.2.0" | ||
}, | ||
"gitHead": "85e1b0cb9e16b320c38224b926df3e74015e920d" | ||
"gitHead": "9f37c15dbb2874f1147e340d5b82d39d417fbbb1" | ||
} |
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
4817
63
Updated@live-change/dao@^0.5.17