add options for marking single notification as read

This commit is contained in:
Henry Jameson 2023-11-13 17:29:25 +02:00
commit ec2937ec1f
11 changed files with 85 additions and 4 deletions

View file

@ -96,6 +96,15 @@ export async function showDesktopNotification (content) {
sw.postMessage({ type: 'desktopNotification', content })
}
export async function closeDesktopNotification ({ id }) {
const { active: sw } = await window.navigator.serviceWorker.getRegistration()
if (id >= 0) {
sw.postMessage({ type: 'desktopNotificationClose', content: { id } })
} else {
sw.postMessage({ type: 'desktopNotificationClose', content: { all: true } })
}
}
export async function updateFocus () {
const { active: sw } = await window.navigator.serviceWorker.getRegistration()
sw.postMessage({ type: 'updateFocus' })