diff options
Diffstat (limited to '03_threads/script.mjs')
| -rw-r--r-- | 03_threads/script.mjs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/03_threads/script.mjs b/03_threads/script.mjs new file mode 100644 index 0000000..4b52ae0 --- /dev/null +++ b/03_threads/script.mjs | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | import Primes from "./build/primes.mjs"; | ||
| 2 | |||
| 3 | var primes = await Primes(); | ||
| 4 | |||
| 5 | var aInput = document.getElementById("aInput"); | ||
| 6 | var bInput = document.getElementById("bInput"); | ||
| 7 | var button = document.getElementById("goButton"); | ||
| 8 | var resultText = document.getElementById("resultText"); | ||
| 9 | |||
| 10 | button.addEventListener("click", () => { | ||
| 11 | var a = Number(aInput.value); | ||
| 12 | var b = Number(bInput.value); | ||
| 13 | const count = primes._primes_in_range(a, b); | ||
| 14 | resultText.innerText = "There are " + count + " primes between " + | ||
| 15 | a + " and " + b; | ||
| 16 | }); | ||
