*Update dist
This commit is contained in:
parent
25cefe8485
commit
ac9cc4cf0d
|
@ -1 +1 @@
|
||||||
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAsBA,wBAAsB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,UAAQ,gBAQvE"}
|
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAoBA,wBAAsB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,UAAQ,gBASvE"}
|
|
@ -1,16 +1,22 @@
|
||||||
import { callModule as callModuleKernel, connectModule as connectModuleKernel, } from "libkernel";
|
|
||||||
import { callModule as callModuleModule, connectModule as connectModuleModule, } from "libkmodule";
|
|
||||||
const DNS_MODULE = "AQBLKpieqOfKVRgMa8k45P4S_ILYgJmswVso4vT1qzoG-A";
|
const DNS_MODULE = "AQBLKpieqOfKVRgMa8k45P4S_ILYgJmswVso4vT1qzoG-A";
|
||||||
let callModule, connectModule;
|
let callModule, connectModule;
|
||||||
if (window.document) {
|
async function loadLibs() {
|
||||||
callModule = callModuleKernel;
|
if (callModule && connectModule) {
|
||||||
connectModule = connectModuleKernel;
|
return;
|
||||||
|
}
|
||||||
|
if (typeof window !== "undefined" && window?.document) {
|
||||||
|
const pkg = (await import("libkernel"));
|
||||||
|
callModule = pkg.callModule;
|
||||||
|
connectModule = pkg.connectModule;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
callModule = callModuleModule;
|
const pkg = (await import("libkmodule"));
|
||||||
connectModule = connectModuleModule;
|
callModule = pkg.callModule;
|
||||||
|
connectModule = pkg.connectModule;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
export async function resolve(domain, params, force = false) {
|
export async function resolve(domain, params, force = false) {
|
||||||
|
await loadLibs();
|
||||||
const [resp, err] = await callModule(DNS_MODULE, "resolve", { domain, params, force });
|
const [resp, err] = await callModule(DNS_MODULE, "resolve", { domain, params, force });
|
||||||
if (err) {
|
if (err) {
|
||||||
throw new Error(err);
|
throw new Error(err);
|
||||||
|
|
Loading…
Reference in New Issue