|
|
@ -60,13 +60,15 @@ self.addEventListener('push', function(event) { |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
var closePromise = notificationPromise.catch(function () { |
|
|
|
var closePromise = notificationPromise.catch(function () { |
|
|
|
console.log('[SW] Closing all notifications on push') |
|
|
|
console.log('[SW] Closing all notifications on push', hasActiveWindows) |
|
|
|
if (userInvisibleSupported || hasActiveWindows) { |
|
|
|
if (userInvisibleSupported) { |
|
|
|
return closeAllNotifications() |
|
|
|
return closeAllNotifications() |
|
|
|
} |
|
|
|
} |
|
|
|
var promise = self.registration.showNotification('Telegram').then(function () { |
|
|
|
var promise = self.registration.showNotification('Telegram').then(function () { |
|
|
|
// return closeAllNotifications()
|
|
|
|
// if (hasActiveWindows) {
|
|
|
|
setTimeout(closeAllNotifications, 100) |
|
|
|
// return closeAllNotifications()
|
|
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
setTimeout(closeAllNotifications, hasActiveWindows ? 0 : 100) |
|
|
|
}).catch(function (error) { |
|
|
|
}).catch(function (error) { |
|
|
|
console.error('Show notification error', error) |
|
|
|
console.error('Show notification error', error) |
|
|
|
}) |
|
|
|
}) |
|
|
|