parent
4c11ac9a27
commit
73fbe89a4b
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in new issue