I'm posting huge amounts of data from my webworker where I parse many 100mbs of files.
for(let y = 0; y < nrOfFiles; y++) {
let items = parsedFiles[y].items;
let nrOfItems = parsedFiles[y].items.length;
for(let x = 0; x < nrOfItems; x++){
postMessage({
aTopic: 'file',
fileIdx: y,
item: JSON.stringify(parsedFiles[y].items[x])
});
}
On the receiving end:
worker.onmessage = function (e) {
if (e.data.aTopic === 'file') {
parsedFiles[e.data.fileIdx].items.push(JSON.parse(e.data.item))
}
}
The tab in Chrome crashes when the data gets to big. Is there any way I can do this more effective?