Add desktop chat notifications
This commit is contained in:
parent
3e09a708f6
commit
2c35afeebf
6 changed files with 82 additions and 49 deletions
|
|
@ -0,0 +1,9 @@
|
|||
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)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue