🐛 (notification) try catch notification

This commit is contained in:
2020-07-02 08:46:19 +02:00
parent 53f8609885
commit f0a9fdd38a
2 changed files with 19 additions and 14 deletions

View File

@@ -1,19 +1,23 @@
declare const Notification: any
export const notify = (message: string) => {
if (!('Notification' in window)) {
return
} else if (Notification.permission === 'granted') {
new Notification(message)
} else if (Notification.permission !== 'denied') {
Notification.requestPermission((permission: any) => {
if (!('permission' in Notification)) {
Notification.permission = permission
}
try {
if (!('Notification' in window)) {
return
} else if (Notification.permission === 'granted') {
new Notification(message)
} else if (Notification.permission !== 'denied') {
Notification.requestPermission((permission: any) => {
if (!('permission' in Notification)) {
Notification.permission = permission
}
if (permission === 'granted') {
new Notification(message)
}
})
if (permission === 'granted') {
new Notification(message)
}
})
}
} catch (error) {
return
}
}