Re:Chrome will aggressively throttle background tabs
by artursapek on Tuesday January 24, 2017 @02:11PM
(#13474476)
Just look out for this not being supported and make sure your stuff still works. Eg, document.hidden might be undefined so don't initialize like this:
doVisualUpdates = (document.hidden === true);
Re:Chrome will aggressively throttle background tabs
by minitech on Tuesday January 24, 2017 @05:43PM
(#13476476)
Well, you’d typically want to do visual updates when document.hidden wasn’t true, which would work fine.
Re:Chrome will aggressively throttle background tabs
by ErikBjare on Wednesday January 25, 2017 @02:52AM
(#13479572)
He probably meant `(browser.hidden === false)` which wouldn't work if browser.hidden is undefined. Use == instead of === and it will work fine.
Re:Chrome will aggressively throttle background tabs
by artursapek on Wednesday January 25, 2017 @09:20AM
(#13481505)
No, the opposite of that. If document.hidden === undefined, you don't want to use this optimization at all. What I was saying is, if you initialize doVisualUpdates as "document.hidden === true", in the case where it's undefined, you will never do visual updates.
In addition to requestAnimationFrame this could be very handy!
Are there any gotchas you have experienced in using this API that I should look out for?