@infinex/iframe-ipc
TypeScript icon, indicating that this package has built-in type declarations

0.0.1 • Public • Published

@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);
})();

Readme

Keywords

none

Package Sidebar

Install

npm i @infinex/iframe-ipc

Weekly Downloads

4

Version

0.0.1

License

MIT

Unpacked Size

7.03 kB

Total Files

8

Last publish

Collaborators

  • yingli42o
  • halfbakedsneed
  • fejesus
  • clementbalestrat
  • jedwatson