mirror of
https://github.com/aljazceru/meshcore-web.git
synced 2025-12-18 08:34:21 +01:00
use service worker to show notifications
This commit is contained in:
@@ -8,11 +8,15 @@ class NotificationUtils {
|
||||
return;
|
||||
}
|
||||
|
||||
// show notification
|
||||
new window.Notification(title, {
|
||||
// show notification via service worker
|
||||
if(navigator.serviceWorker){
|
||||
navigator.serviceWorker.ready.then(function(registration) {
|
||||
registration.showNotification(title, {
|
||||
body: body,
|
||||
icon: "/icon.png",
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user