diff --git a/TODO.md b/TODO.md index 25e87bf..60d1814 100644 --- a/TODO.md +++ b/TODO.md @@ -1,4 +1,3 @@ -* Wait until wasm-hashes is loaded before solving * Better error handling * More options * Add support for other languages \ No newline at end of file diff --git a/widget/src/cap.js b/widget/src/cap.js index 316de92..f1c1f87 100644 --- a/widget/src/cap.js +++ b/widget/src/cap.js @@ -45,6 +45,7 @@ } async solve() { + await until(() => !!this.#workerUrl); this.dispatchEvent("progress", { progress: 0 }); try { @@ -494,7 +495,7 @@ setTimeout(async function () { workerScript = - (await (await fetch("https://cdn.jsdelivr.net/gh/tiagorangel1/cap/lib/wasm-hashes.min.js")).text()) + + (await (await fetch("https://cdn.jsdelivr.net/npm/@cap.js/widget/wasm-hashes.min.js")).text()) + workerFunct .toString() .replace(/^function\s*\([^\)]*\)\s*{|\}$/g, "")