I am working on client side scripts and need to do heavy computations like pushing huge number of objects in an array, it causes JavaScript to stop response and browser hangs gi
You could split it in to different "threads" by using timeouts. Like so:
var counter;
function longRun(start) {
counter = 0;
for (var i = start; i < 3000; i++) {
counter++;
console.log(i);
if (counter > 99) {
setTimeout(function() {
longRun(i+1)
}, 0);
console.log('counter at: ' + i + ' start fake "thread"');
return;
}
}
alert('Done!');
}
longRun(0);
jsFiddle example
I guess it would prevent the warning, but I don't know how sane it really is.