diff --git a/dist/index.d.ts b/dist/index.d.ts index b1da2b4..1b31a15 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1,2 +1,3 @@ export declare function resolve(domain: string, params: any, force?: boolean): Promise; +export declare function ready(): Promise; //# sourceMappingURL=index.d.ts.map \ No newline at end of file diff --git a/dist/index.d.ts.map b/dist/index.d.ts.map index 99a5821..efbd078 100644 --- a/dist/index.d.ts.map +++ b/dist/index.d.ts.map @@ -1 +1 @@ -{"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"} \ No newline at end of file +{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAmBA,wBAAsB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,KAAK,UAAQ,gBAavE;AACD,wBAAsB,KAAK,iBAS1B"} \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index af024ba..3420530 100644 --- a/dist/index.js +++ b/dist/index.js @@ -5,19 +5,31 @@ async function loadLibs() { 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; } } 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) { + throw new Error(err); + } + return resp; +} +export async function ready() { + await loadLibs(); + const [resp, err] = await callModule(DNS_MODULE, "ready"); if (err) { throw new Error(err); }