How can I hide notifications my site is displaying if it is focused and brought to the foreground?

Viewed 142

Context: I am building a progressive web apps that sends my users push notifications with service worker.

Is there a way to ensure that if the user browses to my site while notifications are currently showing that the notifications are hidden?

I want to avoid the situation where they navigated to my site and the notifications are still displaying, now stale.

1 Answers
Related