aboutsummaryrefslogtreecommitdiff
path: root/05_callback/program.mjs
blob: fd85a582f93fa5d0eea68faf8d6a1d1c455ecfb2 (plain)
1
2
3
4
5
6
7
8
9
10
11
import Primes from "./build/primes.mjs"

var primes = await Primes();
const logPtr = primes.addFunction((cstr) => {
	console.log(primes.UTF8ToString(cstr));
}, 'vp');

const a = 1;
const b = 10000000;
const count = primes._primes_in_range(a, b, logPtr);
console.log("There are " + count + " primes between " + a + " and " + b);

Generated with cgit - Back to sebastiano.tronto.net