0

Why is setInterval method very unstable?

4th Feb 2017, 2:37 AM
caleb deng
caleb deng - avatar
4 Antworten
+ 5
What do you mean by "very unstable"? The setInterval() method is not "unstable", but due to JS property of running in a single process ( in blocking mode: while sub-scripts runs, other will waits ), you cannot use it as a clock, meaning doesn't expect that this could be regularly and accuratly called ^^
4th Feb 2017, 8:09 AM
visph
visph - avatar
+ 5
The time between isn't accurate because of what I previously explain...
4th Feb 2017, 9:55 AM
visph
visph - avatar
+ 4
While studying/practicing JS timers, I cross again one solution which may interest you: https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame ( 'requestAnimationFrame' method of 'window' object... )
6th Feb 2017, 7:34 AM
visph
visph - avatar
0
I mean the time between
4th Feb 2017, 9:53 AM
caleb deng
caleb deng - avatar