@seibert/frame-bridge
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -15,2 +15,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
const topWindow = window.top; | ||
const { frames } = window.parent; | ||
if (!topWindow) { | ||
@@ -26,2 +27,13 @@ throw new Error("No top window found!"); | ||
}; | ||
for (let i = 0; i < frames.length; i++) { | ||
try { | ||
if (frames[i] === window) { | ||
continue; | ||
} | ||
frames[i].postMessage(message, "*"); | ||
} | ||
catch (_a) { | ||
/* empty */ | ||
} | ||
} | ||
topWindow.postMessage(message, "*"); | ||
@@ -28,0 +40,0 @@ // receive message |
@@ -24,3 +24,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
functionKey: "ON_NAVIGATION_TO_CONFLUENCE_CONTENT", | ||
args: url ? [NavigationType.URL, url] : [NavigationType.CONTEN_ID, contentId !== null && contentId !== void 0 ? contentId : "", spaceKey !== null && spaceKey !== void 0 ? spaceKey : ""], | ||
args: url ? [NavigationType.URL, url] : [NavigationType.CONTENT_ID, contentId !== null && contentId !== void 0 ? contentId : "", spaceKey !== null && spaceKey !== void 0 ? spaceKey : ""], | ||
}).catch(() => false)); | ||
@@ -27,0 +27,0 @@ return { isResponsible }; |
@@ -31,3 +31,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
} | ||
if (navigationType === NavigationType.CONTEN_ID) { | ||
if (navigationType === NavigationType.CONTENT_ID) { | ||
return { contentId: args[1], spaceKey: args[2] }; | ||
@@ -34,0 +34,0 @@ } |
@@ -22,5 +22,5 @@ export interface FunctionInvocationMessage<A extends unknown[]> extends Message { | ||
URL = "URL", | ||
CONTEN_ID = "CONTENT_ID" | ||
CONTENT_ID = "CONTENT_ID" | ||
} | ||
export {}; | ||
//# sourceMappingURL=types.d.ts.map |
export var NavigationType; | ||
(function (NavigationType) { | ||
NavigationType["URL"] = "URL"; | ||
NavigationType["CONTEN_ID"] = "CONTENT_ID"; | ||
NavigationType["CONTENT_ID"] = "CONTENT_ID"; | ||
})(NavigationType || (NavigationType = {})); |
@@ -6,3 +6,3 @@ { | ||
"description": "A lightweight JavaScript library for seamless communication between a website and embedded iframes. frame-bridge simplifies the integration process by providing a secure and efficient way to exchange messages using the PostMessage API.", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"license": "UNLICENSED", | ||
@@ -9,0 +9,0 @@ "main": "out/index.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
17470
261