+ 6

Time interval period?

What is the minimum amount of time interval for js? I test it and was about 5 ms. when i set it to 1ms. Is it depending on device?

13th May 2017, 4:43 AM
Nima J.
Nima J. - avatar
3 Respostas
+ 8
The min timeout time is 4ms according to: https://developer.mozilla.org/en-US/docs/Web/API/WindowOrWorkerGlobalScope/setTimeout#Minimum_delay_and_timeout_nesting Likely the same for intervals. I could be wrong though, might be 1 ms.
13th May 2017, 4:54 AM
Rrestoring faith
Rrestoring faith - avatar
+ 6
For better timeout acuracy interval, you should look at the new 'requestAnimationFrame()' method, wich is designed for be called every delay instead of wait for the delay before next call ^^ https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame
13th May 2017, 5:30 AM
visph
visph - avatar
+ 4
Is there any solution to get a precise 1 ms?
13th May 2017, 5:20 AM
Nima J.
Nima J. - avatar