Lets say I have an arrays called
(Arr1,Arr2)
and the first array has 2000 objects that have the following
{Cyclic:my.parent,string:"imAString",int:10,Position:{bunchofints}}
lets say I wanted to define Arr2 as
for (i in arr1){let arr1[i]= currentObject arr2.push(currentObject.Position)}
then for sending arr2 to a web worker.
that is the objective and I was wondering how I would go about doing, first send and access the first array then do the other . this and ik there are array buffers that can be defined then a data view can be made from the buffer but I have no idea how you would go about sending what i have above to a worker considering i don't know what is required to send the buffer and how to add the necessary restrictions like byte length. I saw a post that the guy used something like
var arrayBuffer = new ArrayBuffer("?what should go here");
var data = new DataView(arrayBuffer);
var tempArray = new Float32Array(data.byteLength/Float32Array.BYTES_PER_ELEMENT);
is this on the lines of creating what i want and if not , how can i get to transferring my objects to the worker, Thanks have a blast .
Ps: the reason I made this thread is to simplify the already existing information that I thought was a bit general and unwelcoming to new people.