@keplr-ewallet/ewallet-sdk-core
Version:
38 lines • 1.26 kB
JavaScript
import {} from "@keplr-ewallet/stdlib-js";
const KEPLR_IFRAME = "keplr-ewallet-attached";
export function setupIframeElement(url) {
const bodyEls = document.getElementsByTagName("body");
if (bodyEls[0] === undefined) {
console.error("body element not found");
return {
success: false,
err: "body element not found",
};
}
const oldEl = document.getElementById(KEPLR_IFRAME);
if (oldEl !== null) {
console.warn("[keplr] iframe already exists");
return {
success: true,
data: oldEl,
};
}
const bodyEl = bodyEls[0];
console.debug("[keplr] appending iframe");
const iframe = document.createElement("iframe");
iframe.src = url;
iframe.id = KEPLR_IFRAME;
iframe.style.position = "fixed";
iframe.style.top = "0";
iframe.style.left = "0";
iframe.style.width = "100vw";
iframe.style.height = "100vh";
iframe.style.border = "none";
iframe.style.display = "none";
iframe.style.backgroundColor = "transparent";
iframe.style.overflow = "hidden";
iframe.style.zIndex = "1000000";
bodyEl.appendChild(iframe);
return { success: true, data: iframe };
}
//# sourceMappingURL=iframe.js.map