*Update setup to take the class rather than an instance of the class

This commit is contained in:
Derrick Hammer 2022-08-20 02:56:28 -04:00
parent f60d29b95a
commit 37985d1010
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 9 additions and 3 deletions

View File

@ -1,15 +1,21 @@
import { addHandler, ActiveQuery, handleMessage } from "libkmodule";
import { register } from "@lumeweb/kernel-dns-client";
import type { DNSResult, ResolverModule } from "@lumeweb/resolver-common";
import type {
DNSResult,
ResolverModuleConstructor,
ResolverModule,
} from "@lumeweb/resolver-common";
import { RpcNetwork } from "@lumeweb/kernel-rpc-client";
import { ResolverRegistry } from "./resolverRegistry.js";
let resolver: ResolverModule;
export function setup(rm: ResolverModule) {
export function setup(rm: ResolverModuleConstructor) {
addHandler("resolve", handleResolve);
addHandler("register", handleRegister);
addHandler("getSupportedTlds", handleGetSupportedTlds);
onmessage = handleMessage;
resolver = rm;
resolver = new rm(new ResolverRegistry(new RpcNetwork()) as any);
}
async function handleRegister(aq: ActiveQuery) {