timeout event
Opened this issue · 3 comments
Is there any way you could add an event for timeout and also an event for when the notification is closed / dismissed just like node-notifier has ?
+1 to this. HTML5 notifications (at least as implemented by Chrome) call an onclose
handler when closed (via the notification close button) or when the display times out and it closes automatically. I might look into PRing this...
Hey folks - I don't think the native macOS APIs expose this information. The actual display / dismissal of the notifications is super opaque, and you can't even tell from your app whether they have "Do Not Distrub" turned on, hiding your notification entirely. I think if it were possible, it would be part of this NSUserNotificationCenterDelegate
protocol:
https://developer.apple.com/reference/foundation/nsusernotificationcenterdelegate
I'm pretty sure a closed/dismissed event is possible using the undocumented NSUserNotificationCenter didDismissAlert
method. It seems to be working in my fork now (https://github.com/ccnokes/node-mac-notifier). When I have time I'd like to actually contribute it back here (needs improvement first). I looked at Firefox's source for direction on the implementation. Firefox implements the Notification HTML5 spec using the native NSUserNotificationCenter
and it's friends, so it should be possible here to do that but offer even more flexibility (e.g. have dropdown menu in the notification).