Questions tagged [sharedarraybuffer]

`SharedArrayBuffer` is a JavaScript object that provides for sharing memory across threads.

SharedArrayBuffer (MDN, spec) is a JavaScript object that provides for sharing memory across threads, such as web worker threads in browsers, or worker threads in Node.js.

72 questions
1
vote
1 answer

Is web worker unavailable when cross-origin isolation is enabled

Here are my two files, test.js and test.php. test.js: console.log("test.js is loaded") test.php:
張俊芝
  • 187
  • 1
  • 9
1
vote
1 answer

SharedArrayBuffer, Github pages and DNS

Buon giorno, here is the situation: A git repo hosted through Github pages: https://github.com/ossia/score-web ; I configured Github to put it behind the domain https://ossia.io thus at the address https://ossia.io/score-web A WASM app which…
1
vote
1 answer

How Can I Configure Storybook to Use React-App-Rewired?

I'm working on a project that implements react-app-rewired to send headers to the server in order to bypass ReferenceError: SharedArrayBuffer is not defined (I'm getting this error from using the @ffmpeg/ffmpeg library). // config-overrides.js const…
1
vote
1 answer

Is passing Int32Array instead of SharedArrayBuffer supposed to work?

I have some code that creates a shared array buffer and passes the Int32Array and NOT the SharedArrayBuffer to the worker: let worker = new Worker(...); worker.postMessage({ position: { x: createArray(), y: createArray() }, velocity:…
Floss
  • 637
  • 4
  • 16
1
vote
0 answers

Google Drive Picker failing with "docs.google.com refused to connect" after setting Cross-Origin-Opener-Policy and Cross-Origin-Embedder-Policy

To support usage of SharedArrayBuffer in our web app we had to add the response headers: Cross-Origin-Embedder-Policy: require-corp Cross-Origin-Opener-Policy: same-origin We have also tried: Cross-Origin-Embedder-Policy:…
1
vote
0 answers

How to move local File object in and out of Shared Array Buffers JS

I have a web worker running in a while(true) loop, the code is too deep to change it at this point in time. The worker can access a Shared Array Buffer, I have a means to signal that there is data present in it (right now it is just being used with…
yosmo78
  • 489
  • 4
  • 13
1
vote
1 answer

How to enable SharedArrayBuffer in Microsoft Edge Javascript

So the other day, I asked this question about javascript webworkers: Javascript Webworker how to put json information into array buffer. One of the answers I received was to use a SharedArrayBuffer to share memory between the main javascript and the…
1
vote
0 answers

Can a SharedArrayBuffer be picked up by garbage collection in Node?

I'm trying to build a Node application using worker threads, divided into three parts. The primary thread that delegates tasks A dedicated worker thread that updates shared data A pool of worker threads that run calculations on shared data The…
1
vote
2 answers

Not possible to test WebAssembly page locally with Firefox - SharedArrayBuffer not defined

I am using a WebAssembly based software that uses multi-threading that requires SharedArrayBuffer. It runs fine both in Chromium local/deployed, and Firefox 89 deployed, but since the best performance is under Firefox, I want to test and tune it on…
0__
  • 66,707
  • 21
  • 171
  • 266
1
vote
0 answers

How to watch for changes to a SharedArrayBuffer in a sigle worker thread?

I can assure you, this is not your typical "how to watch for changes on a JS variable" post! So I have some worker threads gathering data for a parent thread in Node.js. The parent thread processes the data in ticks of a set timeframe, just keeping…
randy
  • 156
  • 9
1
vote
1 answer

`Uncaught ReferenceError: SharedArrayBuffer is not defined` since Chrome 92

The usage of SharedArrayBuffer causes an error: Uncaught ReferenceError: SharedArrayBuffer is not defined on Chrome 92. Why is this? How can I solve?
agektmr
  • 2,144
  • 15
  • 14
1
vote
1 answer

convert SharedArrayBuffer to normal ArrayBuffer

I am trying to create a new ImageData from a Uint8ClampedArray based on a SharedArrayBuffer, since the ImageData constructor doesnt accept a Uint8ClampedArray based on a SharedArrayBuffer I have to convert it to a normal ArrayBuffer somehow. Any…
Teiem
  • 1,329
  • 15
  • 32
1
vote
0 answers

Is there a blocking ArrayBuffer that is filled by a worker thread?

I want to use ion-js but it a sync library over strings or ArrayBuffers, not a Stream or ReadableStream. I thought to use worker_threads, SharedArrayBuffer, and Atomics to create a ArrayBuffer that is filled in a background thread and blocks waiting…
everett1992
  • 2,351
  • 3
  • 27
  • 38
1
vote
1 answer

Why there is only getter for WebAssembly.Memory.buffer? What's the underlying mechanism if the buffer is SharedArrayBuffer?

As we can setup WebAssembly memory as a shared memory via WebAssembly.Memory: wasmMemory = new WebAssembly.Memory({ "initial": NUMBER, "maximum": NUMBER, "shared": true }); WebAssembly.Memory.buffer only has a getter, so I cannot do the…
tigercosmos
  • 345
  • 3
  • 17
1
vote
6 answers

Can I use SharedArrayBuffer on iOS?

According to Mozilla, there is no browser on iOS supporting the cross-origin-opener-policy, which is one of the security requirements for enabling a SharedArrayBuffer. Does this mean I cannot use a SharedArrayBuffer for any web-application on the…