🎉
This commit is contained in:
19
src/utils/notification.ts
Normal file
19
src/utils/notification.ts
Normal 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)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user