4 ms·
I understand that, but the answer is the same. setTimeout isn't needed as a fallback (since RAF is widely supported), and it's not better time-wise (since the c
by fenomas 5y ago
I understand that, but the answer is the same. setTimeout isn't needed as a fallback (since RAF is widely supported), and it's not better time-wise (since the code we're talking shouldn't run when the document isn't visible).
And to answer the edit, setTimeout is not more reliable than setInterval. They both fire from the same event loop, so timing-wise they're identical (apart from one recurring and the other not).
- beebeepka 5y agoI see. You are downvoting me because you think RAF is only useful for drawing graphics in the active tab, and nothing else. setTimeout is absolutely more reliable than setInterval. Maybe try writing a scheduler/task runner and try for yourself before coming down on people.
- fenomas 5y ago(a) I didn't downvote you. (b) setInterval and setTimeout fire off the same event loop; they can only occur at the same fixed times. Why do you think one is more reliable? Just repeating that it's the case doesn't convey any information. (c) I've written various schedulers; the most recent one is `micro-game-shell` on github if you're interested.
- beebeepka 5y agob) I've observed different time deltas between the two on embedded and standard PC hardware. That's why I think there's a difference. Also, their behaviour has changed over the last few years, making them extremely unreliable as the user changes tabs