-
Notifications
You must be signed in to change notification settings - Fork 5
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
Override and display our own notification #4
Comments
Something like PR #3 ? |
Exactly, what would the code for that look like? |
Not sure, since I asked for documentation samples but haven't received any. I'll try to look at creating some myself soon. |
@seriema did you or anyone have any success implementing this in code? |
Honestly, I haven't tried yet. I'll try to do it soon. |
@seriema any luck? |
@sujithv28 Did you mean override or hide the native notifications and then show them with your own styling? |
@akashnimare I mean override the notifications so I could add an on-click listener which currently isn't supported. |
@akashnimare @seriema Any updates on when this feature will be pushed? |
Not yet. |
@sujithv28 you mean a click handler on the native event? Or on the Electron side? I think I could use some fake sample code of what you imagine you'd like to do, or at least some pretend screenshots/images. |
@seriema So lets say the website you loaded in electron receives an HTML5 notification. As intended, the notification-shim will intercept that and send out a native notification on the Mac with the content of the HTML5 notification sent from the web. The problem is, since that notification object is created by the notification-shim and we have no way of accessing it, I cant add a "onclick" listener to it to know when it was clicked on, or have an option to override it. |
@sujithv28 Sorry for the long delay on this. I've experimented with this and the PR #3. The problem is that adding a click handler to Notification is usually done by just assigning a method to the notification object, like this: Using a The same goes for sending an |
@seriema What about supporting something like event.preventDefault() so we can choose when and when not to actually present the notification. By muting notification-shim from creating its own notification object and presenting it, I can create my own locally using the msg contents and add a listener on my side as well. |
@sujithv28 The notification goes out the moment it's created ( |
Can we do something like event.preventDefault() and then create our own notification to display with the msg parameter?
The main reason I want to do this is because I want to detect when the user taps on the notification so I can redirect to a different URL and unhide the app.
The text was updated successfully, but these errors were encountered: