*Add api for getSupportedTlds
This commit is contained in:
parent
9818d17a06
commit
2b747e72fa
|
@ -7,6 +7,7 @@ let resolver: ResolverModule;
|
|||
export function setup(rm: ResolverModule) {
|
||||
addHandler("resolve", handleResolve);
|
||||
addHandler("register", handleRegister);
|
||||
addHandler("getSupportedTlds", handleGetSupportedTlds);
|
||||
onmessage = handleMessage;
|
||||
resolver = rm;
|
||||
}
|
||||
|
@ -42,4 +43,8 @@ async function handleResolve(aq: ActiveQuery) {
|
|||
aq.respond(ret);
|
||||
}
|
||||
|
||||
function handleGetSupportedTlds(aq: ActiveQuery) {
|
||||
aq.respond(resolver.getSupportedTlds());
|
||||
}
|
||||
|
||||
export * from "./resolverRegistry.js";
|
||||
|
|
|
@ -71,6 +71,14 @@ export class ResolverModule {
|
|||
return resolverError(err);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
async getSupportedTlds(): Promise<string[]> {
|
||||
const [ret, err] = await callModule(this.domain, "getSupportedTlds");
|
||||
if (err) {
|
||||
throw new Error(err);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue