summaryrefslogtreecommitdiff
path: root/main.js
blob: feb6c5a1ec074cddb046c3b89697e3dce749aa04 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
const worker = new Worker(new URL("./worker.js", import.meta.url), {
  type: "module",
});

const sab = new SharedArrayBuffer(1);
console.log(new Uint8Array(sab));

setInterval(() => {
  console.log(new Uint8Array(sab));
}, 100);

worker.onmessage = () => {
  worker.postMessage(sab);
};