fixing notifications if service Worker is not registered
This commit is contained in:
parent
4f9f0ed9a9
commit
e262eb5b79
@ -539,6 +539,12 @@ class WebsocketConnection
|
|||||||
|
|
||||||
Notification.requestPermission(function(result) {
|
Notification.requestPermission(function(result) {
|
||||||
if (result === 'granted') {
|
if (result === 'granted') {
|
||||||
|
if (navigator.serviceWorker == undefined)
|
||||||
|
{
|
||||||
|
var notification = new Notification(text);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
navigator.serviceWorker.ready.then(function(registration) {
|
navigator.serviceWorker.ready.then(function(registration) {
|
||||||
registration.showNotification(text, {
|
registration.showNotification(text, {
|
||||||
icon: './icon.png',
|
icon: './icon.png',
|
||||||
|
Loading…
Reference in New Issue
Block a user