Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

120
Vistas
Can you store a JS object in a SharedArrayBuffer?

I need to share an object between a client side application and a web worker and I heard about SharedArrayBuffers. This is what I'd like to do.

main.js

let myWorker = new Worker('/worker.js')
let mySab = new SharedArrayBuffer(1024)
let myObj = { foo: 'bar', bar: 'foo' }
// Save 'myObj' to 'mySab'
worker.postMessage(sab)

worker.js

self.onmessage = (e) => {
    let myObj = BLANK // Get 'myObj' from SharedArrayBuffer
}

Is this possible? The examples I've seen of ShareArrayBuffers only ever save numbers in the buffer. Any help is appreciated!

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

No, SharedArrayBuffers only store binary data. You can only send copies of objects via the built-in postMessage function.

Sources:

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer

https://developer.mozilla.org/en-US/docs/Web/API/Web_Workers_API/Using_web_workers

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda