*Update setup to take the class rather than an instance of the class
This commit is contained in:
parent
f60d29b95a
commit
37985d1010
12
src/index.ts
12
src/index.ts
|
@ -1,15 +1,21 @@
|
||||||
import { addHandler, ActiveQuery, handleMessage } from "libkmodule";
|
import { addHandler, ActiveQuery, handleMessage } from "libkmodule";
|
||||||
import { register } from "@lumeweb/kernel-dns-client";
|
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;
|
let resolver: ResolverModule;
|
||||||
|
|
||||||
export function setup(rm: ResolverModule) {
|
export function setup(rm: ResolverModuleConstructor) {
|
||||||
addHandler("resolve", handleResolve);
|
addHandler("resolve", handleResolve);
|
||||||
addHandler("register", handleRegister);
|
addHandler("register", handleRegister);
|
||||||
addHandler("getSupportedTlds", handleGetSupportedTlds);
|
addHandler("getSupportedTlds", handleGetSupportedTlds);
|
||||||
onmessage = handleMessage;
|
onmessage = handleMessage;
|
||||||
resolver = rm;
|
resolver = new rm(new ResolverRegistry(new RpcNetwork()) as any);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function handleRegister(aq: ActiveQuery) {
|
async function handleRegister(aq: ActiveQuery) {
|
||||||
|
|
Loading…
Reference in New Issue