Add Desktop Notifications

This commit is contained in:
Steve Richter
2020-11-19 23:06:09 -05:00
committed by Deluan Quintão
parent b8d47d1db4
commit 2397a7e464
12 changed files with 99 additions and 4 deletions
+1
View File
@@ -1,3 +1,4 @@
export * from './baseUrl'
export * from './docsUrl'
export * from './formatters'
export * from './notifications'
+12
View File
@@ -0,0 +1,12 @@
export const sendNotification = (title, body = '', image = '') => {
checkForNotificationPermission()
new Notification(title, {
body: body,
icon: image,
silent: true
})
}
const checkForNotificationPermission = () => {
return 'Notification' in window && Notification.permission === 'granted'
}