mirror of
https://github.com/denoland/deno.git
synced 2024-11-26 16:09:27 -05:00
bdfad23dd0
This commit adds support for sharing SABs between workers.
14 lines
288 B
JavaScript
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);
|
|
};
|