diff --git a/src/main/vars.ts b/src/main/vars.ts index 2200ac6..9c5acf4 100644 --- a/src/main/vars.ts +++ b/src/main/vars.ts @@ -1,4 +1,5 @@ import type { DataFn, KernelAuthStatus } from "libskynet"; +import defer, { DeferredPromise } from "p-defer"; export let queriesNonce = 1; export let queries: any = {}; @@ -17,7 +18,7 @@ let blockForBridge = new Promise((resolve) => { bridgeLoadedResolve = resolve; }); let kernelFrame: HTMLIFrameElement; -let blockForDnsSetup: Promise; +let blockForDnsSetup = defer(); export function getAuthStatusKnown() { return authStatusKnown; @@ -95,10 +96,7 @@ export function setKernelIframe(iframe: HTMLIFrameElement) { kernelFrame = iframe; } -export function setDnsSetupPromise(p: Promise) { - blockForDnsSetup = p; -} -export function getDnsSetupPromise(): Promise { +export function getDnsSetupDefer(): DeferredPromise { return blockForDnsSetup; } export function getAuthStatusResolve(): DataFn {