commit: e2ca107e01c5a0715aa1a1a68496fe514eb9e902
parent 5b0190bef5a9756453d0220b80a18469639c8fe9
Author: lain <lain@soykaf.club>
Date: Thu, 11 Jun 2020 15:24:01 +0200
ServiceWorker: Don't show message via sw if a client is active.
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/sw.js b/src/sw.js
@@ -64,7 +64,7 @@ const maybeShowNotification = async (event) => {
const enabled = await isEnabled()
const activeClients = await getWindowClients()
await setLocale()
- if (enabled && activeClients) {
+ if (enabled && (activeClients.length === 0)) {
const data = event.data.json()
const url = `${self.registration.scope}api/v1/notifications/${data.notification_id}`