1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-26 16:09:27 -05:00
denoland-deno/main.js
Luca Casonato bdfad23dd0
feat: support SharedArrayBuffer sharing between workers (#11040)
This commit adds support for sharing SABs between workers.
2021-07-06 19:42:52 +02:00

14 lines
288 B
JavaScript

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);
};