* Add deferred promise to blockForDnsSetup variable and replace getDnsSetupPromise with getDnsSetupDefer to return a deferred promise.
This commit is contained in:
parent
615a9680e7
commit
f39b6a285c
|
@ -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 {
|
||||||
|
|
Reference in New Issue