From 6cf32f4eb271d3287cf55d1fa502877977851137 Mon Sep 17 00:00:00 2001 From: Dominik Pschenitschni Date: Fri, 9 Sep 2022 14:31:07 +0200 Subject: [PATCH] fix: only warn once if triggeredNotifications are not supported NOTE: Since they are deprecated they shouldn't be supported anywhere anymore. The target of this pull-request is to clean the console logging clean --- src/models/task.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/models/task.ts b/src/models/task.ts index e8dafdf1c..ea394c9c9 100644 --- a/src/models/task.ts +++ b/src/models/task.ts @@ -21,9 +21,13 @@ import UserModel from './user' import AttachmentModel from './attachment' import SubscriptionModel from './subscription' -const SUPPORTS_TRIGGERED_NOTIFICATION = 'Notification' in window && 'showTrigger' in Notification.prototype export const TASK_DEFAULT_COLOR = '#1973ff' +const SUPPORTS_TRIGGERED_NOTIFICATION = 'Notification' in window && 'showTrigger' in Notification.prototype +if (!SUPPORTS_TRIGGERED_NOTIFICATION) { + console.debug('This browser does not support triggered notifications') +} + export function getHexColor(hexColor: string) { if (hexColor === '' || hexColor === '#') { return TASK_DEFAULT_COLOR @@ -176,7 +180,6 @@ export default class TaskModel extends AbstractModel implements ITask { async cancelScheduledNotifications() { if (!SUPPORTS_TRIGGERED_NOTIFICATION) { - console.debug('This browser does not support triggered notifications') return } @@ -211,7 +214,6 @@ export default class TaskModel extends AbstractModel implements ITask { } if (!SUPPORTS_TRIGGERED_NOTIFICATION) { - console.debug('This browser does not support triggered notifications') return }