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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// show notification
|
// show notification via service worker
|
||||||
new window.Notification(title, {
|
if(navigator.serviceWorker){
|
||||||
body: body,
|
navigator.serviceWorker.ready.then(function(registration) {
|
||||||
icon: "/icon.png",
|
registration.showNotification(title, {
|
||||||
});
|
body: body,
|
||||||
|
icon: "/icon.png",
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user