mirror of
https://github.com/Foundry376/Mailspring.git
synced 2026-01-04 07:59:29 +08:00
fix(notifications): Fix notification removal [Sentry 8957]
This commit is contained in:
parent
f7420152df
commit
a3d1287ce8
1 changed files with 5 additions and 3 deletions
|
|
@ -44,7 +44,7 @@ NotificationStore = Reflux.createStore
|
|||
# your package should listen to notificationActionTaken and check the
|
||||
# notification and action objects.
|
||||
@listenTo Actions.notificationActionTaken, ({notification, action}) =>
|
||||
@_removeNotification(notification)() if action.dismisses
|
||||
@_removeNotification(notification) if action.dismisses
|
||||
@listenTo Actions.postNotification, (data) =>
|
||||
@_postNotification(new Notification(data))
|
||||
@listenTo Actions.dismissNotificationsMatching, (criteria) =>
|
||||
|
|
@ -75,14 +75,16 @@ NotificationStore = Reflux.createStore
|
|||
@_notifications[notification.tag] = notification
|
||||
if notification.expiry?
|
||||
timeoutVal = Math.max(0, notification.expiry - Date.now())
|
||||
timeoutId = setTimeout(@_removeNotification(notification), timeoutVal)
|
||||
timeoutId = setTimeout =>
|
||||
@_removeNotification(notification)
|
||||
, timeoutVal
|
||||
notification.timeoutId = timeoutId
|
||||
|
||||
@trigger()
|
||||
|
||||
# Returns a function for removing a particular notification. See usage
|
||||
# above in setTimeout()
|
||||
_removeNotification: (notification) -> =>
|
||||
_removeNotification: (notification) =>
|
||||
console.log "Removed #{notification}" if VERBOSE
|
||||
|
||||
clearTimeout(notification.timeoutId) if notification.timeoutId
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue