Disable push notifications when application is visible to user #60

Open
opened 2025-07-01 16:31:50 +02:00 by retoor · 1 comment
Owner

See title, proposal is to use this: https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API
Can be new introduction to implement the ping with view status.

See title, proposal is to use this: https://developer.mozilla.org/en-US/docs/Web/API/Page_Visibility_API Can be new introduction to implement the ping with view status.
Author
Owner

@retoor You can't using page visibility in service worker, luckily mozilla already has a fix for you ;P

https://developer.mozilla.org/en-US/docs/Web/API/WindowClient

An, will see if this applies. In example it does notification click event, that's tooo late ofcourse. I wads thinking about not even sending the notification if window is not visible, so i wanted to track visibility state.

> @retoor You can't using page visibility in service worker, luckily mozilla already has a fix for you ;P > > https://developer.mozilla.org/en-US/docs/Web/API/WindowClient An, will see if this applies. In example it does notification click event, that's tooo late ofcourse. I wads thinking about not even sending the notification if window is not visible, so i wanted to track visibility state.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: retoor/snek#60