This commit is contained in:
2020-07-01 23:47:51 +02:00
parent 3adef6ee28
commit 3b38a8477b
39 changed files with 428 additions and 241 deletions

19
src/utils/notification.ts Normal file
View File

@@ -0,0 +1,19 @@
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
}
if (permission === 'granted') {
new Notification(message)
}
})
}
}