aboutsummaryrefslogtreecommitdiff
path: root/04_no_block/script.mjs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--04_no_block/script.mjs14
1 files changed, 14 insertions, 0 deletions
diff --git a/04_no_block/script.mjs b/04_no_block/script.mjs
new file mode 100644
index 0000000..b9c27ea
--- /dev/null
+++ b/04_no_block/script.mjs
@@ -0,0 +1,14 @@
1var aInput = document.getElementById("aInput");
2var bInput = document.getElementById("bInput");
3var button = document.getElementById("goButton");
4var resultText = document.getElementById("resultText");
5
6var worker = new Worker("./worker.mjs", { type: "module" });
7
8button.addEventListener("click", () => worker.postMessage({
9 a: Number(aInput.value),
10 b: Number(bInput.value)
11}));
12
13worker.onmessage = (e) => resultText.innerText = "There are " +
14 e.data.result + " primes between " + e.data.a + " and " + e.data.b;

Generated with cgit - Back to sebastiano.tronto.net