From e262eb5b79429b7b7307597dd1df7b429ec2a1c1 Mon Sep 17 00:00:00 2001 From: Jonas Weinz Date: Sun, 31 Mar 2019 15:55:54 +0200 Subject: [PATCH] fixing notifications if service Worker is not registered --- websocket_connection.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/websocket_connection.js b/websocket_connection.js index c3ae82f..818f88b 100644 --- a/websocket_connection.js +++ b/websocket_connection.js @@ -539,6 +539,12 @@ class WebsocketConnection Notification.requestPermission(function(result) { if (result === 'granted') { + if (navigator.serviceWorker == undefined) + { + var notification = new Notification(text); + return; + } + navigator.serviceWorker.ready.then(function(registration) { registration.showNotification(text, { icon: './icon.png',