Add Desktop Notifications
This commit is contained in:
committed by
Deluan Quintão
parent
b8d47d1db4
commit
2397a7e464
@@ -1,3 +1,4 @@
|
||||
export * from './baseUrl'
|
||||
export * from './docsUrl'
|
||||
export * from './formatters'
|
||||
export * from './notifications'
|
||||
|
||||
@@ -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'
|
||||
}
|
||||
Reference in New Issue
Block a user