aboutsummaryrefslogtreecommitdiff
path: root/src/services/desktop_notification_utils
diff options
context:
space:
mode:
authorHenry Jameson <me@hjkos.com>2023-10-25 18:58:33 +0300
committerHenry Jameson <me@hjkos.com>2023-10-25 18:58:33 +0300
commit73fbe89a4b4e545796e9cc6aae707de0a4eed3a1 (patch)
treebe06697ffc34a2e6e83f23c50a0379ba30e6c7e6 /src/services/desktop_notification_utils
parent4c11ac9a27696a7fe57eeb486257d8f7c1295548 (diff)
initial work on showing notifications through serviceworkers
Diffstat (limited to 'src/services/desktop_notification_utils')
-rw-r--r--src/services/desktop_notification_utils/desktop_notification_utils.js7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/services/desktop_notification_utils/desktop_notification_utils.js b/src/services/desktop_notification_utils/desktop_notification_utils.js
index b84a1f75..c31a1030 100644
--- a/src/services/desktop_notification_utils/desktop_notification_utils.js
+++ b/src/services/desktop_notification_utils/desktop_notification_utils.js
@@ -1,9 +1,8 @@
+import { showDesktopNotification as swDesktopNotification } from '../sw/sw.js'
+
export const showDesktopNotification = (rootState, desktopNotificationOpts) => {
if (!('Notification' in window && window.Notification.permission === 'granted')) return
if (rootState.statuses.notifications.desktopNotificationSilence) { return }
- const desktopNotification = new window.Notification(desktopNotificationOpts.title, desktopNotificationOpts)
- // Chrome is known for not closing notifications automatically
- // according to MDN, anyway.
- setTimeout(desktopNotification.close.bind(desktopNotification), 5000)
+ swDesktopNotification(desktopNotificationOpts)
}