♻️ (notification)
This commit is contained in:
@@ -9,22 +9,17 @@ export const setNotificationInstance = (sn: ShowNotification) => {
|
||||
showNotification = sn
|
||||
}
|
||||
|
||||
export const notify: ShowNotification = async (
|
||||
title: string,
|
||||
options?: NotificationOptions
|
||||
) => {
|
||||
const showCustomNotification = (
|
||||
title: string,
|
||||
options?: NotificationOptions
|
||||
) => {
|
||||
export const notify: ShowNotification = async (title, options?) => {
|
||||
const showCustomNotification = async () => {
|
||||
if (!showNotification) {
|
||||
return
|
||||
}
|
||||
showNotification(title, {
|
||||
await showNotification(title, {
|
||||
icon: '/img/icons/apple-touch-icon.png',
|
||||
badge: '/img/badge.png',
|
||||
tag: 'binome',
|
||||
renotify: true,
|
||||
silent: true,
|
||||
...options
|
||||
})
|
||||
}
|
||||
@@ -35,7 +30,7 @@ export const notify: ShowNotification = async (
|
||||
}
|
||||
|
||||
if (Notification.permission === 'granted') {
|
||||
showCustomNotification(title, options)
|
||||
showCustomNotification()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -43,7 +38,7 @@ export const notify: ShowNotification = async (
|
||||
const permission = await Notification.requestPermission()
|
||||
|
||||
if (permission === 'granted') {
|
||||
showCustomNotification(title, options)
|
||||
showCustomNotification()
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
|
||||
Reference in New Issue
Block a user