@kamai/iframe-bridge
Drop the takeoff widget into your own app.
@kamai/iframe-bridge is our PostMessage SDK for secure iframe integrations. Embed the Kamai takeoff experience inside your product and talk to it from the host page.
npm install @kamai/iframe-bridge
Loading Kamai…
This is the live Kamai app, embedded the same way you would embed it. Open app.kamai.io in its own tab.
connect({ targetWindow, eventCallback, checkConnection?, timeout? }): Promise<IframeBridge>
Open the PostMessage channel between your host page and the embedded Kamai widget, then grab the typed API.
npm install @kamai/iframe-bridge
import { IframeBridge } from "@kamai/iframe-bridge";
const iframe = document.getElementById("kamai") as HTMLIFrameElement;
const bridge = await IframeBridge.connect({
targetWindow: iframe.contentWindow!,
checkConnection: true,
eventCallback: (event, data) => console.log(event, data),
});
const api = bridge.getKamaiAPI();Every method above is the real typed surface of the current release - pick one to see how it's called.