fix for warning when serviceWorker is present without getNotifications

This commit is contained in:
Jesse D. McDonald 2020-04-17 17:42:23 -05:00
parent ada365b76f
commit 4e72bd4258
1 changed files with 8 additions and 4 deletions

View File

@ -631,11 +631,15 @@ $(function (){
function closeNotifications(){ function closeNotifications(){
try { try {
navigator.serviceWorker.ready.then(function(registration){ navigator.serviceWorker.ready.then(function(registration){
try {
if ('getNotifications' in registration) {
registration.getNotifications({tag: 'notice'}).then(function(notifications){ registration.getNotifications({tag: 'notice'}).then(function(notifications){
for (const notification of notifications) { for (const notification of notifications) {
notification.close(); notification.close();
} }
}); });
}
} catch (err) {}
}); });
} catch (err) {} } catch (err) {}
} }