+ 9
JavaScript stack overflow solution
I want to write something like this: function f(){ //something setTimeout(f,x); } I'm using setTimeout becouse I want to repeat the function again and again, so I'm afraid of stack overflow. But, what value I ought to write instand of x, if I want to be sure that the code will run at old computers, too, but I want the smallest interval of repeating?
1 Resposta
+ 3
You might want something like:
window.requestAnimationFrame(f);
This is especially used in animations, where easier to load animations will be loaded faster while intensive animations load slower.