aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/service-worker.ts7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/service-worker.ts b/src/service-worker.ts
index 18c839b1..0de69bdf 100644
--- a/src/service-worker.ts
+++ b/src/service-worker.ts
@@ -127,7 +127,12 @@ sw.addEventListener('push', async (event: PushEvent) => {
console.error(error);
}
- if (navigator.userAgent.includes('Chrome')) {
+ if (
+ navigator.userAgent.includes('Chrome') &&
+ !(await sw.clients.matchAll({ type: 'window', includeUncontrolled: true })).some(
+ (client) => client.visibilityState === 'visible'
+ )
+ ) {
await sw.registration.showNotification('due.moe', {
body: 'No new notifications',
icon: '/favicon-196x196.png',