refactor: remove old bootup code and use a refer to signal when we are booted

This commit is contained in:
Derrick Hammer 2023-07-17 10:44:21 -04:00
parent 93dc1e76de
commit 73cf786750
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
2 changed files with 10 additions and 29 deletions

View File

@ -221,33 +221,5 @@ async function boot() {
document.body.appendChild(getKernelIframe());
});
await kernelLoaded();
await swarmClient.addRelay(
"fd35779a2dcae738308098e8f6702e25c282a52cce972ff2f96bcc50d5043c99"
);
await peerDiscoveryClient.register(
"_AEPtjxDCq3H4nmLLV7-P0L3D_d_Aude4i9O9S498dXcFw"
);
await ipfsClient.ready();
setupContextMenus(engine);
dnsSetup();
await getDnsSetupDefer().promise;
console.log("ready");
weAreBooted();
}
async function dnsSetup() {
const resolvers = [
"_B0tpRWWzAf77qfhiRMx1EGTDURht_2V9VsUmMqIzcpW4Q", // ens
// "vAMl33T1TusZqZmJl9mlWJCbYm_Lu1TPjE3aSl2ZFHE_yg", // hns
];
for (const resolver of resolvers) {
await dnsClient.registerResolver(resolver);
}
getDnsSetupDefer().resolve();
}
boot();

View File

@ -19,6 +19,7 @@ let blockForBridge = new Promise((resolve) => {
});
let kernelFrame: HTMLIFrameElement;
let blockForDnsSetup = defer();
let booted = defer();
export function getAuthStatusKnown() {
return authStatusKnown;
@ -112,3 +113,11 @@ export function getBlockForBridge(): Promise<unknown> {
export function getBridgeLoadedResolve(): DataFn {
return bridgeLoadedResolve;
}
export function getBooted(): Promise<unknown> {
return booted.promise;
}
export function weAreBooted(): void {
booted.resolve();
}