JavaScript setInterval () and minimized windows

Appears when you minimize windows or swap tabs, the JavaScript method setInterval()starts to become incredibly unreliable.

I just finished work on the time tracking function in the application that I am working on, which is being managed setInterval. All this worked fine until I started minimizing the window and came back to it later, only to find out that time has increased a small fraction of what it does when the window appears on the screen.

This seems to be a "feature" at the browser level.

Is there a simple alternative, can I swap this to where time units are really respected?

+4
source share
1

, Chrome , / , 1000 .

Web Workers, . .

+2

Source: https://habr.com/ru/post/1619104/


All Articles