You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Timers are never called back in the background. #6
In some browsers, requestAnimationFrame is paused in background tabs. However, setTimeout and setInterval may continue, albeit possibly throttled. This asymmetrical behavior can have undesired side-effects, such as an ever-growing timer queue that is never flushed because timers are being scheduled but never invoked.
One way to fix this might be to guarantee that the first tick of a scheduled, eligible timer is invoked after at most one second, even in a background tab, by using setTimeout or setInterval internally rather than relying solely on requestAnimationFrame. We could guarantee that timers receive at least one tick per second this way, but I think it would be sufficient to only have this special behavior for the first tick—it’s nice if we do as little as possible in the background.
Or, we could just tick at least once per second, no matter what.
Activity