Add Desktop Notifications

This commit is contained in:
Steve Richter 2020-11-19 23:06:09 -05:00 • committed by Deluan Quintão
commit 2397a7e464
12 changed files with 99 additions and 4 deletions

View file

@ -1,3 +1,4 @@
export * from './baseUrl'
export * from './docsUrl'
export * from './formatters'
export * from './notifications'

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'
}