question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support page visibility API

See original GitHub issue

https://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:closed
  • Created a year ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
zerodevxcommented, Oct 9, 2022

I’m working on this!

0reactions
Prinzhorncommented, Oct 10, 2022

Nice, ping me for a review when you got the PR up

Read more comments on GitHub >

github_iconTop Results From Across the Web

Page Visibility | Can I use... Support tables for HTML5, CSS3, etc
Page Visibility. - REC. JavaScript API for determining whether a document is visible on the display. Usage % of. all users, all tracked,...
Read more >
Page Visibility API
The Page Visibility API defines a means for site developers to programmatically determine the current visibility of a document and be notified of...
Read more >
Getting Started with the Page Visibility API - Section.io
The Page Visibility API is a browser API that provides a way to determine which browser tabs are currently active or idle.
Read more >
Using the Page Visibility API - web.dev
The Page Visibility API performs a simple but important function – it lets your application know when a page is visible to the...
Read more >
JavaScript API — Page Visibility API | by Rajan V - codeburst
JavaScript API — Page Visibility API ... The API is really simple. It has two attributes named hidden, visibilityState and an event visibilitychange....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found