@psibase/plugin
Advanced tools
Comparing version 0.0.4 to 0.0.5
declare type Options = { | ||
src: string; | ||
src?: string; | ||
}; | ||
export declare const connect: (options: Options) => Promise<import("penpal").AsyncMethodReturns<import("penpal").CallSender>>; | ||
export {}; |
@@ -5,5 +5,14 @@ "use strict"; | ||
const penpal_1 = require("penpal"); | ||
const getSupervisorHref = (subDomain = 'supervisor-sys') => { | ||
const currentUrl = window.location.href; | ||
const url = new URL(currentUrl); | ||
const hostnameParts = url.hostname.split('.'); | ||
hostnameParts.shift(); | ||
hostnameParts.unshift(subDomain); | ||
url.hostname = hostnameParts.join('.'); | ||
return url.origin; | ||
}; | ||
const connect = (options) => { | ||
const iframe = document.createElement('iframe'); | ||
iframe.src = options.src; | ||
iframe.src = options.src || getSupervisorHref(); | ||
iframe.style.display = 'none'; | ||
@@ -10,0 +19,0 @@ if (document.readyState === 'complete' || |
{ | ||
"name": "@psibase/plugin", | ||
"version": "0.0.4", | ||
"version": "0.0.5", | ||
"description": "A template for creating npm packages using TypeScript and VSCode", | ||
@@ -5,0 +5,0 @@ "main": "./lib/index.js", |
5892
40