*prettier

This commit is contained in:
Derrick Hammer 2022-08-03 12:05:10 -04:00
parent 9071ed0592
commit f76391d46e
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 132 additions and 130 deletions

View File

@ -4,19 +4,18 @@ import {Buffer} from "buffer";
const DHT_MODULE = "AQD1IgE4lTZkq1fqdoYGojKRNrSk0YQ_wrHbRtIiHDrnow";
let callModule: any,
connectModule: any;
let callModule: any, connectModule: any;
async function loadLibs() {
if (callModule && connectModule) {
return;
}
if (typeof window !== "undefined" && window?.document) {
const pkg = (await import("libkernel"));
const pkg = await import("libkernel");
callModule = pkg.callModule;
connectModule = pkg.connectModule;
} else {
const pkg = (await import("libkmodule"));
const pkg = await import("libkmodule");
callModule = pkg.callModule;
connectModule = pkg.connectModule;
}
@ -57,7 +56,10 @@ export class DHT {
public async removeRelay(pubkey: string): Promise<void> {
await loadLibs();
const dht = !this.useDefaultDht ? this.id : undefined;
const [, err] = await callModule(DHT_MODULE, "removeRelay", {pubkey, dht});
const [, err] = await callModule(DHT_MODULE, "removeRelay", {
pubkey,
dht,
});
if (err) {
throw new Error(err);
}