✨ (notification) add img to notification
This commit is contained in:
@@ -20,27 +20,32 @@ export const notify = (
|
|||||||
title: string,
|
title: string,
|
||||||
options?: NotificationOptions | undefined
|
options?: NotificationOptions | undefined
|
||||||
) => {
|
) => {
|
||||||
try {
|
const showCustomNotification = (
|
||||||
console.log(showNotification)
|
title: string,
|
||||||
|
options?: NotificationOptions | undefined
|
||||||
|
) => {
|
||||||
if (!showNotification) {
|
if (!showNotification) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
showNotification(title, {
|
||||||
|
icon: '/img/icons/apple-touch-icon.png',
|
||||||
|
...options
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
if (!('Notification' in window)) {
|
if (!('Notification' in window)) {
|
||||||
return
|
return
|
||||||
} else if (Notification.permission === 'granted') {
|
} else if (Notification.permission === 'granted') {
|
||||||
showNotification(title, options)
|
showCustomNotification(title, options)
|
||||||
} else if (Notification.permission !== 'denied') {
|
} else if (Notification.permission !== 'denied') {
|
||||||
Notification.requestPermission((permission: any) => {
|
Notification.requestPermission((permission: any) => {
|
||||||
if (!showNotification) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if (!('permission' in Notification)) {
|
if (!('permission' in Notification)) {
|
||||||
Notification.permission = permission
|
Notification.permission = permission
|
||||||
}
|
}
|
||||||
|
|
||||||
if (permission === 'granted') {
|
if (permission === 'granted') {
|
||||||
showNotification(title, options)
|
showCustomNotification(title, options)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user