fix for warning when serviceWorker is present without getNotifications
This commit is contained in:
parent
ada365b76f
commit
4e72bd4258
|
|
@ -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) {}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue