Answer the question
In order to leave comments, you need to log in
To prevent a JS timer from freezing in a Chrome tab?
I use an intervalset of 0.5 seconds. I fold and make a stopwatch in the browser.
After 3.5 hours I switch to the stopwatch tab, I see: 1.5 hours have passed ..
How to make the script not freeze?
How does VK do it for example?
Answer the question
In order to leave comments, you need to log in
Do not count via setInteval. Create a constant with the start date of the timer, and every N-times calculate the amount of time from the initial constant up to the current moment.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question