@infinex/iframe-ipc
v0.0.1
Published
A simple client / server framework for IPC between an iframe and its parent
Downloads
2
Keywords
Readme
@infinex/iframe-ipc
Enable simple IPC between a window and an iframe
Usage
iframe
import { IFrameIPCChild } from "@infinex/iframe-ipc";
new IFrameIPCChild({
hello({ name }) => {
return `Hello, ${name}!`;
}
});
parent
import { IFrameIPCParent } from "@infinex/iframe-ipc";
const iframe = document.querySelector("iframe");
const { call } = new IFrameIPCParent(iframe, "my-website.com:443");
(async () => {
const result = await call("hello", { name: "friend" });
console.log(result);
})();