* Add deferred promise to blockForDnsSetup variable and replace getDnsSetupPromise with getDnsSetupDefer to return a deferred promise.

This commit is contained in:
Derrick Hammer 2023-04-09 19:43:10 -04:00
parent 615a9680e7
commit f39b6a285c
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 3 additions and 5 deletions

View File

@ -1,4 +1,5 @@
import type { DataFn, KernelAuthStatus } from "libskynet"; import type { DataFn, KernelAuthStatus } from "libskynet";
import defer, { DeferredPromise } from "p-defer";
export let queriesNonce = 1; export let queriesNonce = 1;
export let queries: any = {}; export let queries: any = {};
@ -17,7 +18,7 @@ let blockForBridge = new Promise((resolve) => {
bridgeLoadedResolve = resolve; bridgeLoadedResolve = resolve;
}); });
let kernelFrame: HTMLIFrameElement; let kernelFrame: HTMLIFrameElement;
let blockForDnsSetup: Promise<void>; let blockForDnsSetup = defer();
export function getAuthStatusKnown() { export function getAuthStatusKnown() {
return authStatusKnown; return authStatusKnown;
@ -95,10 +96,7 @@ export function setKernelIframe(iframe: HTMLIFrameElement) {
kernelFrame = iframe; kernelFrame = iframe;
} }
export function setDnsSetupPromise(p: Promise<void>) { export function getDnsSetupDefer(): DeferredPromise<any> {
blockForDnsSetup = p;
}
export function getDnsSetupPromise(): Promise<void> {
return blockForDnsSetup; return blockForDnsSetup;
} }
export function getAuthStatusResolve(): DataFn { export function getAuthStatusResolve(): DataFn {