Support page visibility API
See original GitHub issuehttps://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API
Among other things I’m using toasts to display warnings when something didn’t work. If you tab out of the browser (or the Electron app in my case) you might miss it.
I don’t know how easy this would be to implement. In a perfect world the toasts would pause (progress bar, timers) when document.hidden
and continue when it becomes visible again. If that’s too complex then an easier approach would be to queue toasts if document.hidden
and insert them on visibilitychange
.
Oh well, heureka! The pausable
feature literally already exists, so it should actually be trivial to pause all toasts when the document becomes invisible. But this should be a separate feature (you might not want pausable
via hover but still pause them when the document is invisible). What I’m saying is that the functionality to pause the toast/timers exists and it would just be a second boolean (global, not per toast hover) that triggers it.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (6 by maintainers)
I’m working on this!
Nice, ping me for a review when you got the PR up