Don't try to cancel notifications if the browser does not support it

This commit is contained in:
kolaente 2020-02-09 13:12:54 +01:00
parent 80b363872e
commit 010812ef06
Signed by untrusted user: konrad
GPG Key ID: F40E70337AB24C9B

View File

@ -145,6 +145,11 @@ export default class TaskModel extends AbstractModel {
} }
async cancelScheduledNotifications() { async cancelScheduledNotifications() {
if (!('showTrigger' in Notification.prototype)) {
console.debug('This browser does not support triggered notifications')
return
}
const registration = await navigator.serviceWorker.getRegistration() const registration = await navigator.serviceWorker.getRegistration()
if (typeof registration === 'undefined') { if (typeof registration === 'undefined') {
return return