@seibert/frame-bridge
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Frame Bridge

Usage top level frame

Start host listener

startHostListener: (navigation: NavigationFn) => void

Initialize host listener with navigation function. The navigation function is called when a navigation event is triggered. It must be of type NavigationFn.

export type NavigateFn = ({ contentId, spaceKey }: { contentId: string; spaceKey?: string }) => Promise<boolean>;
import { startHostListener } from "@seibert/frame-bridge";
startHostListener(onNavigate)

Usage embedded frame

Validate if top level frame started host listener

isHostListening: () => Promise<boolean>

Call function isHostListening, which returns true if host is listening

import { isHostListening } from "@seibert/frame-bridge";
(async () => {
    const isListening = await isHostListening();
    console.log("Is host listening?", isListening);
})()

Check if top level frame handled navigation

onNavigationToConfluenceContent: ({ contentId, spaceKey }: { contentId: string; spaceKey?: string }) => Promise<{ isResponsible: boolean }>

Call function onNavigationToConfluenceContent with contentId and spaceKey of the space to navigate to. It returns { isResponsible: true } if top level frame handled navigation.

import { onNavigationToConfluenceContent } from "@seibert/frame-bridge";
onNavigationToConfluenceContent({
        contentId: "1933581",
        spaceKey: "Duck",
    }).then((res) => console.log("RESULT NAV: ", res.isResponsible));

Readme

Keywords

none

Package Sidebar

Install

npm i @seibert/frame-bridge

Weekly Downloads

11

Version

1.0.4

License

UNLICENSED

Unpacked Size

17.5 kB

Total Files

26

Last publish

Collaborators

  • cinja.
  • shess
  • jdepoix_sm
  • julianwolf