@meteor-web3/meteor-iframe
v1.0.17
Published
Make dataverse-kernel running in iframe.
Downloads
218
Readme
meteor-iframe
Make dataverse-kernel running in iframe.
Installation
pnpm install @meteor-web3/meteor-iframe
Run demo
requirements
pnpm install // install dependencies
pnpm build // build the package
pnpm demo // run demo
the demo will be running on http://localhost:5173/.
Usage
Directly import in your project, and it will automatically inject the iframe with id meteor-iframe
.
import "@meteor-web3/meteor-iframe";
To communicate with the kernel in iframe, you can use the Communicator.
import { Communicator } from "@meteor-web3/communicator";
const communicator = new Communicator({
source: window,
target: iframeWindow,
runningEnv: "Client",
// (required) only external-wallet is supported for now, so you need to handle the ethereumRequest method yourself.
methodHandler: async (args) => {
console.log("Client received method call:", args);
if (args.method === "ethereumRequest") {
const res = await window.ethereum.request(args.params);
console.log("Client responded to ethereumRequest:", res);
return res;
}
}
});