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(){
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) {}
}