mirror of
https://github.com/zoldar/jenot.git
synced 2026-01-03 14:32:54 +00:00
Send notifications via service worker
This commit is contained in:
parent
ad85a07030
commit
217d1ee87d
1 changed files with 7 additions and 5 deletions
|
|
@ -14,9 +14,11 @@ export function authorizeNotifications(afterCallback) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function sendNotification(titleSuffix, message) {
|
export async function sendNotification(titleSuffix, message) {
|
||||||
return new Notification(`Jenot ${titleSuffix}`, {
|
return navigator.serviceWorker.ready.then((registration) =>
|
||||||
body: message,
|
registration.showNotification(`Jenot ${titleSuffix}`, {
|
||||||
icon: notificationIcon,
|
body: message,
|
||||||
});
|
icon: notificationIcon,
|
||||||
|
}),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue