@scalecube/utils
Advanced tools
Comparing version 0.2.10-develop.1596044522 to 0.2.10-snapshot.feature-addressable.1596051005
declare type Collection<T> = T[] | { | ||
[key: string]: T; | ||
}; | ||
export declare const assert: (predicate: boolean, msg: string) => void; | ||
export declare const assert: (predicate: boolean, msg: string) => void | never; | ||
export declare const isDefined: (val: any) => boolean; | ||
@@ -6,0 +6,0 @@ export declare const assertDefined: (val: any, msg?: string) => void; |
@@ -314,6 +314,3 @@ 'use strict'; | ||
ports: transfer, | ||
data: { | ||
detail: Object.assign({}, message.detail), | ||
type: message.type, | ||
}, | ||
data: message, | ||
type: 'message', | ||
@@ -354,3 +351,7 @@ }); | ||
} | ||
postMessage(message) { | ||
postMessage(message, ports) { | ||
const event = { | ||
ports, | ||
data: message, | ||
}; | ||
if (!this.otherPort) { | ||
@@ -360,6 +361,6 @@ return; | ||
if (this.otherSideStart) { | ||
this.otherPort.dispatchEvent({ data: message }); | ||
this.otherPort.dispatchEvent(event); | ||
} | ||
else { | ||
this.queue.push(message); | ||
this.queue.push(event); | ||
} | ||
@@ -394,3 +395,3 @@ } | ||
this.otherSideStart = true; | ||
this.queue.forEach((message) => this.otherPort && this.otherPort.dispatchEvent({ data: message })); | ||
this.queue.forEach((event) => this.otherPort && this.otherPort.dispatchEvent(event)); | ||
} | ||
@@ -397,0 +398,0 @@ stopSending() { |
export declare const saveToLogs: (identifier: string, msg: string, extra: { | ||
[key: string]: any; | ||
}, debug?: boolean | undefined, type?: "log" | "warn") => void; | ||
}, debug?: boolean | undefined, type?: 'log' | 'warn') => void; |
@@ -30,3 +30,3 @@ interface IMessagePortPolyfill { | ||
}): boolean; | ||
postMessage(message: string): void; | ||
postMessage(message: string, ports?: MessagePort[]): void; | ||
addEventListener(type: string, listener: any): void; | ||
@@ -33,0 +33,0 @@ removeEventListener(type: string, listener: any): void; |
declare type Collection<T> = T[] | { | ||
[key: string]: T; | ||
}; | ||
export declare const assert: (predicate: boolean, msg: string) => void; | ||
export declare const assert: (predicate: boolean, msg: string) => void | never; | ||
export declare const isDefined: (val: any) => boolean; | ||
@@ -6,0 +6,0 @@ export declare const assertDefined: (val: any, msg?: string) => void; |
export declare const saveToLogs: (identifier: string, msg: string, extra: { | ||
[key: string]: any; | ||
}, debug?: boolean | undefined, type?: "log" | "warn") => void; | ||
}, debug?: boolean | undefined, type?: 'log' | 'warn') => void; |
@@ -30,3 +30,3 @@ interface IMessagePortPolyfill { | ||
}): boolean; | ||
postMessage(message: string): void; | ||
postMessage(message: string, ports?: MessagePort[]): void; | ||
addEventListener(type: string, listener: any): void; | ||
@@ -33,0 +33,0 @@ removeEventListener(type: string, listener: any): void; |
@@ -19,3 +19,7 @@ // polyfill MessagePort and MessageChannel | ||
} | ||
postMessage(message) { | ||
postMessage(message, ports) { | ||
const event = { | ||
ports, | ||
data: message, | ||
}; | ||
if (!this.otherPort) { | ||
@@ -25,6 +29,6 @@ return; | ||
if (this.otherSideStart) { | ||
this.otherPort.dispatchEvent({ data: message }); | ||
this.otherPort.dispatchEvent(event); | ||
} | ||
else { | ||
this.queue.push(message); | ||
this.queue.push(event); | ||
} | ||
@@ -59,3 +63,3 @@ } | ||
this.otherSideStart = true; | ||
this.queue.forEach((message) => this.otherPort && this.otherPort.dispatchEvent({ data: message })); | ||
this.queue.forEach((event) => this.otherPort && this.otherPort.dispatchEvent(event)); | ||
} | ||
@@ -62,0 +66,0 @@ stopSending() { |
@@ -9,6 +9,3 @@ export const applyPostMessagePolyfill = () => { | ||
ports: transfer, | ||
data: { | ||
detail: Object.assign({}, message.detail), | ||
type: message.type, | ||
}, | ||
data: message, | ||
type: 'message', | ||
@@ -15,0 +12,0 @@ }); |
{ | ||
"name": "@scalecube/utils", | ||
"version": "0.2.10-develop.1596044522", | ||
"version": "0.2.10-snapshot.feature-addressable.1596051005", | ||
"private": false, | ||
@@ -24,3 +24,3 @@ "main": "cjs/index.js", | ||
"dependencies": { | ||
"@scalecube/api": "^0.2.10-develop.1596044522" | ||
"@scalecube/api": "^0.2.10-snapshot.feature-addressable.1596051005" | ||
}, | ||
@@ -38,3 +38,3 @@ "devDependencies": { | ||
}, | ||
"gitHead": "8860b329cb20743494baf1347f887a56f5d82fcb" | ||
"gitHead": "99045aa37640f5d36b0216d4fa6265d9c986b5b4" | ||
} |
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
1080
57312