From 4e72bd42583bb4d41603ea182dd0a3fb19952ef5 Mon Sep 17 00:00:00 2001 From: Jesse McDonald Date: Fri, 17 Apr 2020 17:42:23 -0500 Subject: [PATCH] fix for warning when serviceWorker is present without getNotifications --- js/pacosako_ui.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/js/pacosako_ui.js b/js/pacosako_ui.js index 029a9c1..ae87164 100644 --- a/js/pacosako_ui.js +++ b/js/pacosako_ui.js @@ -631,11 +631,15 @@ $(function (){ function closeNotifications(){ try { navigator.serviceWorker.ready.then(function(registration){ - registration.getNotifications({tag: 'notice'}).then(function(notifications){ - for (const notification of notifications) { - notification.close(); + try { + if ('getNotifications' in registration) { + registration.getNotifications({tag: 'notice'}).then(function(notifications){ + for (const notification of notifications) { + notification.close(); + } + }); } - }); + } catch (err) {} }); } catch (err) {} }