Blazor.Notifications
Blazor.Notifications copied to clipboard
Adding opening tab on click notification
Add the ability to open a tab or window to a new page when clicking on a notification, as in the documentation example
https://developer.mozilla.org/en-US/docs/Web/API/Notification/click_event
You can add the url property to the NotificationOptions class.
Then in script.js change the opening function create like:
export function create(title, options) {
var notify = new Notification(title, options);
if (options.URL != null) {
notify.onclick = (event) => {
event.preventDefault();
window.open(options.url, "_blank");
event.target.close(); // close notifycation
};
}
return notify;
}