webext-bridge
Advanced tools
Comparing version 6.0.0-rc2 to 6.0.0-rc3
@@ -1,3 +0,3 @@ | ||
import { S as Stream } from './stream-50ab2bdc.js'; | ||
import { G as GetDataType, D as Destination, d as GetReturnType, O as OnMessageCallback, E as Endpoint } from './types-b1fcc4f1.js'; | ||
import { S as Stream } from './stream-b168003c.js'; | ||
import { G as GetDataType, D as Destination, c as GetReturnType, O as OnMessageCallback, E as Endpoint } from './types-99f3870b.js'; | ||
import * as type_fest from 'type-fest'; | ||
@@ -4,0 +4,0 @@ |
import { | ||
PortMessage, | ||
createDeliveryLogger, | ||
createFingerprint, | ||
decodeConnectionArgs | ||
} from "./chunk-G7AOUSAZ.js"; | ||
import { | ||
createEndpointRuntime, | ||
createStreamWirings | ||
} from "./chunk-3SJGMQZN.js"; | ||
} from "./chunk-IIMH42J6.js"; | ||
import { | ||
@@ -12,50 +18,216 @@ formatEndpoint, | ||
import browser from "webextension-polyfill"; | ||
var messageQueue = /* @__PURE__ */ new Set(); | ||
var portMap = /* @__PURE__ */ new Map(); | ||
var pendingResponses = createDeliveryLogger(); | ||
var connMap = /* @__PURE__ */ new Map(); | ||
var oncePortConnectedCbs = /* @__PURE__ */ new Map(); | ||
var onceSessionEndCbs = /* @__PURE__ */ new Map(); | ||
var oncePortConnected = (endpointName, cb) => { | ||
oncePortConnectedCbs.set( | ||
endpointName, | ||
(oncePortConnectedCbs.get(endpointName) || /* @__PURE__ */ new Set()).add(cb) | ||
); | ||
return () => { | ||
const su = oncePortConnectedCbs.get(endpointName); | ||
if ((su == null ? void 0 : su.delete(cb)) && (su == null ? void 0 : su.size) === 0) | ||
oncePortConnectedCbs.delete(endpointName); | ||
}; | ||
}; | ||
var onceSessionEnded = (sessionFingerprint, cb) => { | ||
onceSessionEndCbs.set( | ||
sessionFingerprint, | ||
(onceSessionEndCbs.get(sessionFingerprint) || /* @__PURE__ */ new Set()).add(cb) | ||
); | ||
}; | ||
var notifyEndpoint = (endpoint) => ({ | ||
withFingerprint: (fingerprint) => { | ||
const nextChain = (v) => ({ and: () => v }); | ||
const notifications = { | ||
aboutIncomingMessage: (message) => { | ||
const recipient = connMap.get(endpoint); | ||
PortMessage.toExtensionContext(recipient.port, { | ||
status: "incoming", | ||
message | ||
}); | ||
return nextChain(notifications); | ||
}, | ||
aboutSuccessfulDelivery: (receipt) => { | ||
const sender = connMap.get(endpoint); | ||
PortMessage.toExtensionContext(sender.port, { | ||
status: "delivered", | ||
receipt | ||
}); | ||
return nextChain(notifications); | ||
}, | ||
aboutMessageUndeliverability: (resolvedDestination, message) => { | ||
const sender = connMap.get(endpoint); | ||
if ((sender == null ? void 0 : sender.fingerprint) === fingerprint) { | ||
PortMessage.toExtensionContext(sender.port, { | ||
status: "undeliverable", | ||
resolvedDestination, | ||
message | ||
}); | ||
} | ||
return nextChain(notifications); | ||
}, | ||
whenDeliverableTo: (targetEndpoint) => { | ||
const notifyDeliverability = () => { | ||
const origin = connMap.get(endpoint); | ||
if ((origin == null ? void 0 : origin.fingerprint) === fingerprint && connMap.has(targetEndpoint)) { | ||
PortMessage.toExtensionContext(origin.port, { | ||
status: "deliverable", | ||
deliverableTo: targetEndpoint | ||
}); | ||
return true; | ||
} | ||
}; | ||
if (!notifyDeliverability()) { | ||
const unsub = oncePortConnected(targetEndpoint, notifyDeliverability); | ||
onceSessionEnded(fingerprint, unsub); | ||
} | ||
return nextChain(notifications); | ||
}, | ||
aboutSessionEnded: (endedSessionFingerprint) => { | ||
const conn = connMap.get(endpoint); | ||
if ((conn == null ? void 0 : conn.fingerprint) === fingerprint) { | ||
PortMessage.toExtensionContext(conn.port, { | ||
status: "terminated", | ||
fingerprint: endedSessionFingerprint | ||
}); | ||
} | ||
return nextChain(notifications); | ||
} | ||
}; | ||
return notifications; | ||
} | ||
}); | ||
var sessFingerprint = createFingerprint(); | ||
var endpointRuntime = createEndpointRuntime( | ||
"background", | ||
(message) => { | ||
if (message.origin.context === "background" && message.destination.context !== "background" && !message.destination.tabId) | ||
throw new TypeError("When sending messages from background page, use @tabId syntax to target specific tab"); | ||
const { context: destName, tabId: destTabId, frameId: destFrameId } = message.destination; | ||
const { tabId: srcTabId } = message.origin; | ||
if (message.origin.context === "background" && message.destination.context !== "background" && !message.destination.tabId) { | ||
throw new TypeError( | ||
"When sending messages from background page, use @tabId syntax to target specific tab" | ||
); | ||
} | ||
const resolvedSender = formatEndpoint({ | ||
...message.origin, | ||
...message.origin.context === "window" && { context: "content-script" } | ||
}); | ||
const resolvedDestination = formatEndpoint({ | ||
...message.destination, | ||
...message.destination.context === "window" && { | ||
context: "content-script" | ||
}, | ||
tabId: message.destination.tabId || message.origin.tabId | ||
}); | ||
message.destination.tabId = null; | ||
message.destination.frameId = null; | ||
let resolvedDestination = ["popup", "options"].includes(destName) ? destName : `${destName === "window" ? "content-script" : destName}@${destTabId || srcTabId}`; | ||
if (destFrameId) | ||
resolvedDestination = `${resolvedDestination}.${destFrameId}`; | ||
const destPort = portMap.get(resolvedDestination); | ||
if (destPort) | ||
destPort.postMessage(message); | ||
else | ||
messageQueue.add({ resolvedDestination, message }); | ||
const dest = connMap.get(resolvedDestination); | ||
const sender = connMap.get(resolvedSender); | ||
const deliver = () => { | ||
notifyEndpoint(resolvedDestination).withFingerprint(dest.fingerprint).aboutIncomingMessage(message); | ||
const receipt = { | ||
message, | ||
to: dest.fingerprint, | ||
from: { | ||
endpointId: resolvedSender, | ||
fingerprint: sender == null ? void 0 : sender.fingerprint | ||
} | ||
}; | ||
if (message.messageType === "message") | ||
pendingResponses.add(receipt); | ||
if (message.messageType === "reply") | ||
pendingResponses.remove(message.messageID); | ||
if (sender) { | ||
notifyEndpoint(resolvedSender).withFingerprint(sender.fingerprint).aboutSuccessfulDelivery(receipt); | ||
} | ||
}; | ||
if (dest == null ? void 0 : dest.port) { | ||
deliver(); | ||
} else if (message.messageType === "message") { | ||
if (message.origin.context === "background") { | ||
oncePortConnected(resolvedDestination, deliver); | ||
} else if (sender) { | ||
notifyEndpoint(resolvedSender).withFingerprint(sender.fingerprint).aboutMessageUndeliverability(resolvedDestination, message).and().whenDeliverableTo(resolvedDestination); | ||
} | ||
} | ||
}, | ||
(message) => { | ||
const resolvedSender = formatEndpoint({ | ||
...message.origin, | ||
...message.origin.context === "window" && { context: "content-script" } | ||
}); | ||
const sender = connMap.get(resolvedSender); | ||
const receipt = { | ||
message, | ||
to: sessFingerprint, | ||
from: { | ||
endpointId: resolvedSender, | ||
fingerprint: sender.fingerprint | ||
} | ||
}; | ||
notifyEndpoint(resolvedSender).withFingerprint(sender.fingerprint).aboutSuccessfulDelivery(receipt); | ||
} | ||
); | ||
browser.runtime.onConnect.addListener((incomingPort) => { | ||
const portId = incomingPort.name || formatEndpoint({ | ||
var _a; | ||
const connArgs = decodeConnectionArgs(incomingPort.name); | ||
if (!connArgs) | ||
return; | ||
connArgs.endpointName || (connArgs.endpointName = formatEndpoint({ | ||
context: "content-script", | ||
tabId: incomingPort.sender.tab.id, | ||
frameId: incomingPort.sender.frameId | ||
})); | ||
const { tabId: linkedTabId, frameId: linkedFrameId } = parseEndpoint( | ||
connArgs.endpointName | ||
); | ||
connMap.set(connArgs.endpointName, { | ||
fingerprint: connArgs.fingerprint, | ||
port: incomingPort | ||
}); | ||
const { context, tabId: linkedTabId, frameId: linkedFrameId } = parseEndpoint(portId); | ||
if (!linkedTabId && context !== "popup" && context !== "options") | ||
return; | ||
portMap.set(portId, incomingPort); | ||
messageQueue.forEach((queuedMsg) => { | ||
if (queuedMsg.resolvedDestination === portId) { | ||
incomingPort.postMessage(queuedMsg.message); | ||
messageQueue.delete(queuedMsg); | ||
} | ||
(_a = oncePortConnectedCbs.get(connArgs.endpointName)) == null ? void 0 : _a.forEach((cb) => cb()); | ||
oncePortConnectedCbs.delete(connArgs.endpointName); | ||
onceSessionEnded(connArgs.fingerprint, () => { | ||
const rogueMsgs = pendingResponses.entries().filter((pendingMessage) => pendingMessage.to === connArgs.fingerprint); | ||
pendingResponses.remove(rogueMsgs); | ||
rogueMsgs.forEach((rogueMessage) => { | ||
if (rogueMessage.from.endpointId === "background") { | ||
endpointRuntime.endTransaction(rogueMessage.message.transactionId); | ||
} else { | ||
notifyEndpoint(rogueMessage.from.endpointId).withFingerprint(rogueMessage.from.fingerprint).aboutSessionEnded(connArgs.fingerprint); | ||
} | ||
}); | ||
}); | ||
incomingPort.onDisconnect.addListener(() => { | ||
if (portMap.get(portId) === incomingPort) | ||
portMap.delete(portId); | ||
var _a2, _b; | ||
if (((_a2 = connMap.get(connArgs.endpointName)) == null ? void 0 : _a2.fingerprint) === connArgs.fingerprint) | ||
connMap.delete(connArgs.endpointName); | ||
(_b = onceSessionEndCbs.get(connArgs.fingerprint)) == null ? void 0 : _b.forEach((cb) => cb()); | ||
onceSessionEndCbs.delete(connArgs.fingerprint); | ||
}); | ||
incomingPort.onMessage.addListener((message) => { | ||
var _a; | ||
if ((_a = message == null ? void 0 : message.origin) == null ? void 0 : _a.context) { | ||
message.origin.tabId = linkedTabId; | ||
message.origin.frameId = linkedFrameId; | ||
endpointRuntime.handleMessage(message); | ||
incomingPort.onMessage.addListener((msg) => { | ||
var _a2, _b; | ||
if (msg.type === "sync") { | ||
const allActiveSessions = [...connMap.values()].map( | ||
(conn) => conn.fingerprint | ||
); | ||
const stillPending = msg.pendingResponses.filter( | ||
(fp) => allActiveSessions.includes(fp.to) | ||
); | ||
pendingResponses.add(...stillPending); | ||
msg.pendingResponses.filter( | ||
(deliveryReceipt) => !allActiveSessions.includes(deliveryReceipt.to) | ||
).forEach( | ||
(deliveryReceipt) => notifyEndpoint(connArgs.endpointName).withFingerprint(connArgs.fingerprint).aboutSessionEnded(deliveryReceipt.to) | ||
); | ||
msg.pendingDeliveries.forEach( | ||
(intendedDestination) => notifyEndpoint(connArgs.endpointName).withFingerprint(connArgs.fingerprint).whenDeliverableTo(intendedDestination) | ||
); | ||
return; | ||
} | ||
if (msg.type === "deliver" && ((_b = (_a2 = msg.message) == null ? void 0 : _a2.origin) == null ? void 0 : _b.context)) { | ||
msg.message.origin.tabId = linkedTabId; | ||
msg.message.origin.frameId = linkedFrameId; | ||
endpointRuntime.handleMessage(msg.message); | ||
} | ||
}); | ||
@@ -62,0 +234,0 @@ }); |
@@ -1,3 +0,3 @@ | ||
import { S as Stream } from './stream-50ab2bdc.js'; | ||
import { G as GetDataType, D as Destination, d as GetReturnType, O as OnMessageCallback, E as Endpoint } from './types-b1fcc4f1.js'; | ||
import { S as Stream } from './stream-b168003c.js'; | ||
import { G as GetDataType, D as Destination, c as GetReturnType, O as OnMessageCallback, E as Endpoint } from './types-99f3870b.js'; | ||
import * as type_fest from 'type-fest'; | ||
@@ -4,0 +4,0 @@ |
import { | ||
createPersistentPort | ||
} from "./chunk-OZGBKVJJ.js"; | ||
} from "./chunk-ODNERRIQ.js"; | ||
import "./chunk-G7AOUSAZ.js"; | ||
import { | ||
usePostMessaging | ||
} from "./chunk-FLKFPNRC.js"; | ||
} from "./chunk-QYJXY7GZ.js"; | ||
import { | ||
createEndpointRuntime, | ||
createStreamWirings | ||
} from "./chunk-3SJGMQZN.js"; | ||
} from "./chunk-IIMH42J6.js"; | ||
import "./chunk-KEPAOTUH.js"; | ||
@@ -16,11 +17,8 @@ | ||
var port = createPersistentPort(); | ||
var endpointRuntime = createEndpointRuntime( | ||
"content-script", | ||
(message) => { | ||
if (message.destination.context === "window") | ||
win.postMessage(message); | ||
else | ||
port.postMessage(message); | ||
} | ||
); | ||
var endpointRuntime = createEndpointRuntime("content-script", (message) => { | ||
if (message.destination.context === "window") | ||
win.postMessage(message); | ||
else | ||
port.postMessage(message); | ||
}); | ||
win.onMessage((message) => { | ||
@@ -34,2 +32,12 @@ message.origin = { | ||
port.onMessage(endpointRuntime.handleMessage); | ||
port.onFailure((message) => { | ||
if (message.origin.context === "window") { | ||
win.postMessage({ | ||
type: "error", | ||
transactionID: message.transactionId | ||
}); | ||
return; | ||
} | ||
endpointRuntime.endTransaction(message.transactionId); | ||
}); | ||
function allowWindowMessaging(nsps) { | ||
@@ -36,0 +44,0 @@ win.setNamespace(nsps); |
@@ -1,3 +0,3 @@ | ||
import { S as Stream } from './stream-50ab2bdc.js'; | ||
import { G as GetDataType, D as Destination, d as GetReturnType, O as OnMessageCallback, E as Endpoint } from './types-b1fcc4f1.js'; | ||
import { S as Stream } from './stream-b168003c.js'; | ||
import { G as GetDataType, D as Destination, c as GetReturnType, O as OnMessageCallback, E as Endpoint } from './types-99f3870b.js'; | ||
import * as type_fest from 'type-fest'; | ||
@@ -4,0 +4,0 @@ |
import { | ||
createPersistentPort | ||
} from "./chunk-OZGBKVJJ.js"; | ||
} from "./chunk-ODNERRIQ.js"; | ||
import "./chunk-G7AOUSAZ.js"; | ||
import { | ||
createEndpointRuntime, | ||
createStreamWirings | ||
} from "./chunk-3SJGMQZN.js"; | ||
} from "./chunk-IIMH42J6.js"; | ||
import "./chunk-KEPAOTUH.js"; | ||
@@ -9,0 +10,0 @@ |
@@ -1,3 +0,3 @@ | ||
import { E as Endpoint } from './types-b1fcc4f1.js'; | ||
export { c as DataTypeKey, D as Destination, E as Endpoint, G as GetDataType, d as GetReturnType, H as HybridUnsubscriber, I as IBridgeMessage, a as IInternalMessage, O as OnMessageCallback, b as ProtocolMap, P as ProtocolWithReturn, R as RuntimeContext, S as StreamInfo } from './types-b1fcc4f1.js'; | ||
import { E as Endpoint } from './types-99f3870b.js'; | ||
export { B as BridgeMessage, b as DataTypeKey, D as Destination, E as Endpoint, G as GetDataType, c as GetReturnType, H as HybridUnsubscriber, I as InternalMessage, O as OnMessageCallback, a as ProtocolMap, P as ProtocolWithReturn, R as RuntimeContext, S as StreamInfo } from './types-99f3870b.js'; | ||
import 'type-fest'; | ||
@@ -4,0 +4,0 @@ |
@@ -1,3 +0,3 @@ | ||
import { S as Stream } from './stream-50ab2bdc.js'; | ||
import { G as GetDataType, D as Destination, d as GetReturnType, O as OnMessageCallback, E as Endpoint } from './types-b1fcc4f1.js'; | ||
import { S as Stream } from './stream-b168003c.js'; | ||
import { G as GetDataType, D as Destination, c as GetReturnType, O as OnMessageCallback, E as Endpoint } from './types-99f3870b.js'; | ||
import * as type_fest from 'type-fest'; | ||
@@ -4,0 +4,0 @@ |
import { | ||
createPersistentPort | ||
} from "./chunk-OZGBKVJJ.js"; | ||
} from "./chunk-ODNERRIQ.js"; | ||
import "./chunk-G7AOUSAZ.js"; | ||
import { | ||
createEndpointRuntime, | ||
createStreamWirings | ||
} from "./chunk-3SJGMQZN.js"; | ||
} from "./chunk-IIMH42J6.js"; | ||
import "./chunk-KEPAOTUH.js"; | ||
@@ -9,0 +10,0 @@ |
@@ -1,3 +0,3 @@ | ||
import { S as Stream } from './stream-50ab2bdc.js'; | ||
import { G as GetDataType, D as Destination, d as GetReturnType, O as OnMessageCallback, E as Endpoint } from './types-b1fcc4f1.js'; | ||
import { S as Stream } from './stream-b168003c.js'; | ||
import { G as GetDataType, D as Destination, c as GetReturnType, O as OnMessageCallback, E as Endpoint } from './types-99f3870b.js'; | ||
import * as type_fest from 'type-fest'; | ||
@@ -4,0 +4,0 @@ |
import { | ||
createPersistentPort | ||
} from "./chunk-OZGBKVJJ.js"; | ||
} from "./chunk-ODNERRIQ.js"; | ||
import "./chunk-G7AOUSAZ.js"; | ||
import { | ||
createEndpointRuntime, | ||
createStreamWirings | ||
} from "./chunk-3SJGMQZN.js"; | ||
} from "./chunk-IIMH42J6.js"; | ||
import "./chunk-KEPAOTUH.js"; | ||
@@ -9,0 +10,0 @@ |
@@ -1,46 +0,46 @@ | ||
import { JsonValue, Jsonify } from 'type-fest'; | ||
import type { JsonValue, Jsonify } from 'type-fest' | ||
declare type RuntimeContext = 'devtools' | 'background' | 'popup' | 'options' | 'content-script' | 'window'; | ||
declare type RuntimeContext = 'devtools' | 'background' | 'popup' | 'options' | 'content-script' | 'window' | ||
interface Endpoint { | ||
context: RuntimeContext; | ||
tabId: number; | ||
frameId?: number; | ||
context: RuntimeContext | ||
tabId: number | ||
frameId?: number | ||
} | ||
interface IBridgeMessage<T extends JsonValue> { | ||
sender: Endpoint; | ||
id: string; | ||
data: T; | ||
timestamp: number; | ||
sender: Endpoint | ||
id: string | ||
data: T | ||
timestamp: number | ||
} | ||
declare type OnMessageCallback<T extends JsonValue, R = void | JsonValue> = (message: IBridgeMessage<T>) => R | Promise<R>; | ||
declare type OnMessageCallback<T extends JsonValue, R = void | JsonValue> = (message: IBridgeMessage<T>) => R | Promise<R> | ||
interface IInternalMessage { | ||
origin: Endpoint; | ||
destination: Endpoint; | ||
transactionId: string; | ||
hops: string[]; | ||
messageID: string; | ||
messageType: 'message' | 'reply'; | ||
err?: JsonValue; | ||
data?: JsonValue | void; | ||
timestamp: number; | ||
origin: Endpoint | ||
destination: Endpoint | ||
transactionId: string | ||
hops: string[] | ||
messageID: string | ||
messageType: 'message' | 'reply' | ||
err?: JsonValue | ||
data?: JsonValue | void | ||
timestamp: number | ||
} | ||
interface StreamInfo { | ||
streamId: string; | ||
channel: string; | ||
endpoint: Endpoint; | ||
streamId: string | ||
channel: string | ||
endpoint: Endpoint | ||
} | ||
interface HybridUnsubscriber { | ||
(): void; | ||
dispose: () => void; | ||
close: () => void; | ||
(): void | ||
dispose: () => void | ||
close: () => void | ||
} | ||
declare type Destination = Endpoint | RuntimeContext | string; | ||
declare const ProtocolWithReturnSymbol: unique symbol; | ||
declare type Destination = Endpoint | RuntimeContext | `${RuntimeContext}@${number}` | ||
declare const ProtocolWithReturnSymbol: unique symbol | ||
interface ProtocolWithReturn<Data, Return> { | ||
data: Jsonify<Data>; | ||
return: Jsonify<Return>; | ||
/** | ||
data: Jsonify<Data> | ||
return: Jsonify<Return> | ||
/** | ||
* Type differentiator only. | ||
*/ | ||
[ProtocolWithReturnSymbol]: true; | ||
[ProtocolWithReturnSymbol]: true | ||
} | ||
@@ -52,6 +52,6 @@ /** | ||
} | ||
declare type DataTypeKey = keyof ProtocolMap extends never ? string : keyof ProtocolMap; | ||
declare type GetDataType<K extends DataTypeKey, Fallback extends JsonValue = undefined> = K extends keyof ProtocolMap ? ProtocolMap[K] extends ProtocolWithReturn<infer Data, any> ? Data : ProtocolMap[K] : Fallback; | ||
declare type GetReturnType<K extends DataTypeKey, Fallback extends JsonValue = undefined> = K extends keyof ProtocolMap ? ProtocolMap[K] extends ProtocolWithReturn<any, infer Return> ? Return : void : Fallback; | ||
declare type DataTypeKey = keyof ProtocolMap extends never ? string : keyof ProtocolMap | ||
declare type GetDataType<K extends DataTypeKey, Fallback extends JsonValue = undefined> = K extends keyof ProtocolMap ? ProtocolMap[K] extends ProtocolWithReturn<infer Data, any> ? Data : ProtocolMap[K] : Fallback | ||
declare type GetReturnType<K extends DataTypeKey, Fallback extends JsonValue = undefined> = K extends keyof ProtocolMap ? ProtocolMap[K] extends ProtocolWithReturn<any, infer Return> ? Return : void : Fallback | ||
export { Destination as D, Endpoint as E, GetDataType as G, HybridUnsubscriber as H, IBridgeMessage as I, OnMessageCallback as O, ProtocolWithReturn as P, RuntimeContext as R, StreamInfo as S, IInternalMessage as a, ProtocolMap as b, DataTypeKey as c, GetReturnType as d }; | ||
export { Destination as D, Endpoint as E, GetDataType as G, HybridUnsubscriber as H, IBridgeMessage as I, OnMessageCallback as O, ProtocolWithReturn as P, RuntimeContext as R, StreamInfo as S, IInternalMessage as a, ProtocolMap as b, DataTypeKey as c, GetReturnType as d } |
@@ -1,3 +0,3 @@ | ||
import { S as Stream } from './stream-50ab2bdc.js'; | ||
import { G as GetDataType, D as Destination, d as GetReturnType, O as OnMessageCallback, E as Endpoint } from './types-b1fcc4f1.js'; | ||
import { S as Stream } from './stream-b168003c.js'; | ||
import { G as GetDataType, D as Destination, c as GetReturnType, O as OnMessageCallback, E as Endpoint } from './types-99f3870b.js'; | ||
import * as type_fest from 'type-fest'; | ||
@@ -4,0 +4,0 @@ |
import { | ||
usePostMessaging | ||
} from "./chunk-FLKFPNRC.js"; | ||
} from "./chunk-QYJXY7GZ.js"; | ||
import { | ||
createEndpointRuntime, | ||
createStreamWirings | ||
} from "./chunk-3SJGMQZN.js"; | ||
} from "./chunk-IIMH42J6.js"; | ||
import "./chunk-KEPAOTUH.js"; | ||
@@ -16,3 +16,8 @@ | ||
); | ||
win.onMessage(endpointRuntime.handleMessage); | ||
win.onMessage((msg) => { | ||
if ("type" in msg && "transactionID" in msg) | ||
endpointRuntime.endTransaction(msg.transactionID); | ||
else | ||
endpointRuntime.handleMessage(msg); | ||
}); | ||
function setNamespace(nsps) { | ||
@@ -19,0 +24,0 @@ win.setNamespace(nsps); |
{ | ||
"name": "webext-bridge", | ||
"version": "6.0.0-rc2", | ||
"version": "6.0.0-rc3", | ||
"description": "Messaging in Web Extensions made easy. Out of the box.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
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
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
213779
51
5510