Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

timeout event #8

Open
nsnashu opened this issue Aug 3, 2016 · 3 comments
Open

timeout event #8

nsnashu opened this issue Aug 3, 2016 · 3 comments

Comments

@nsnashu
Copy link

nsnashu commented Aug 3, 2016

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 ?

@ccnokes
Copy link
Contributor

ccnokes commented Nov 8, 2016

+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...

@bengotow
Copy link

bengotow commented Nov 8, 2016

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

@ccnokes
Copy link
Contributor

ccnokes commented Nov 15, 2016

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).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants