Intentar clonar en profundidad un búfer de matriz (es decir, pasar por valor, no por referencia)
const deepClone = (buf) => { uint32 = new Uint32Array(buf); let newBuf = new ArrayBuffer(buf.byteLength); let uint32new = new Uint32Array(newBuf); // This works fine uint32.forEach((el, i) => { uint32new[i] = el; }); // but this doesn't uint32new = uint32.map((el) => {return el}); // neither does this uint32new = [...uint32]; return newBuf; };Los últimos 2 simplemente devuelven un búfer vacío (0)
¿por qué?