aboutsummaryrefslogtreecommitdiff
path: root/05_callback/program.mjs
diff options
context:
space:
mode:
Diffstat (limited to '05_callback/program.mjs')
-rw-r--r--05_callback/program.mjs11
1 files changed, 11 insertions, 0 deletions
diff --git a/05_callback/program.mjs b/05_callback/program.mjs
new file mode 100644
index 0000000..fd85a58
--- /dev/null
+++ b/05_callback/program.mjs
@@ -0,0 +1,11 @@
1import Primes from "./build/primes.mjs"
2
3var primes = await Primes();
4const logPtr = primes.addFunction((cstr) => {
5 console.log(primes.UTF8ToString(cstr));
6}, 'vp');
7
8const a = 1;
9const b = 10000000;
10const count = primes._primes_in_range(a, b, logPtr);
11console.log("There are " + count + " primes between " + a + " and " + b);

Generated with cgit - Back to sebastiano.tronto.net