Timer doesn't work when window is inactive
Hi, I'm using the angular-timer for countdown to a specific time. But unfortunately when the windows is inactive (another window overlays the browser window), the timer doesn't work correct anymore. A 20 minutes countdown can take about 2 hours. I think its a "energy saving" feature for setTimeout/setInterval. Is there a way to overcome this problem?
Can you create a plunkr for this issue? It's just using browser's setTimeout & I am not sure if there is anything else we can do to avoid this.
The browser throttle setTimeout and setInterval calls to no more than once per second when run inside of an inactive or minimized tab. Example: http://jsfiddle.net/simevidas/gHZSW/ ---> when windows is inactive the timeout of 100ms is not adhered.
http://stackoverflow.com/questions/6585112/javascript-performance-when-running-in-an-unfocused-tab
here another post about that problem: http://stackoverflow.com/questions/5927284/how-can-i-make-setinterval-also-work-when-a-tab-is-inactive-in-chrome/5927432#12522580
web workers are not affected, but I don't see how web workers could be used in this context.
Having the same problem. Is there a fix coming anytime soon? Thanks
I think this is related to the browser. I am facing the same issue when my website need to send an ajax request every 5 minutes, but when the tab is inactive for some time (>20 minutes I think), the setInterval callback is not executed at all.