3 ms·
Well, the visibility API is only of very limited use. The document will report itself to be still shown even if the window is minimized or in the background (or
by panzi 12y ago
Well, the visibility API is only of very limited use. The document will report itself to be still shown even if the window is minimized or in the background (or on iOS if I switched to another App!). It only reports the document as hidden if you switch to another tab. So if you want to use it to e.g. pause animation if the window isn't shown you will still burn unnecessary CPU cycles (ok, on iOS any timer is paused automatically if you switch to another App, so it kinda works out there - but not on the Desktop).
- acdha 12y agoThe more people use it, the more likely it is that mobile browsers will optimize for power consumption by doing things like toggling visibility if you've registered a state change event handler.
- panzi 12y agoIt's not that it doesn't call the event handler. It's about in which situations it's called and in which it isn't. And because the situation is the same on iOS Safari, Desktop Firefox and Desktop Chrome I guess it is meant to be like that? Anyway, as I said because timers are paused for background apps it isn't really a problem on iOS, but it is on the Desktop (or Laptop).
- acdha 12y ago> It's about in which situations it's called and in which it isn't My point was that those situations are not fixed forever. It'd be very easy to imagine e.g. MobileSafari starting to trigger visibility hidden when you switch to another app.