aboutsummaryrefslogtreecommitdiff
path: root/04_no_block/script.mjs
blob: b9c27eaaa16d8d697e5cc5ef26551a3a57631798 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
var aInput = document.getElementById("aInput");
var bInput = document.getElementById("bInput");
var button = document.getElementById("goButton");
var resultText = document.getElementById("resultText");

var worker = new Worker("./worker.mjs", { type: "module" });

button.addEventListener("click", () => worker.postMessage({
	a: Number(aInput.value),
	b: Number(bInput.value)
}));

worker.onmessage = (e) => resultText.innerText = "There are " +
	e.data.result + " primes between " + e.data.a + " and " + e.data.b;

Generated with cgit - Back to sebastiano.tronto.net