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
Feature request: detect if a notification already exists #3
Comments
Hi, there is a function {
buttons: {
value: "Close",
onClick: (notification) => {
notification.disableButtons();
// Do anything you want :)
notification.close(); // Or notification.remove() if you want the notification to close immediately
}
}
} The functions you ask for seems easy enough to do though, so I can make it. Edit: I can also make an option to automatically disable buttons if a button is clicked, before calling the callback. |
I could see both options making sense. It would be nice if both could be implemented, but if not then I'd say per notification. It would make the code a lot cleaner if I didn't have to use a method like notification.close() each time I wanted to add one to the screen. Can you go into a bit more detail about the disableButtons function? It seems like you can only use it within the buttons that are a part of a notification, which doesn't really help in this use case. |
I will add the The // SimpleNotification.[type] return a SimpleNotification object
let n = SimpleNotification.info({
title: "Title",
buttons: {
value: "Test",
onClick: n => {
// Inside buttons
n.disableButtons();
}
}
}, {
events: {
onDeath: n => {
// Inside events
n.disableButtons();
}
}
});
// Basically when you have a SimpleNotification object
n.disableButtons(); |
Closing due to feature implementation. Documented the new features in #4 |
It would be a really useful feature if when a new notification is opened there was an option to detect if one is already present and to decide what action to take if there is. For example, you could choose to still show the new notification (default) or to close the old one as as it closes bring in the new notification.
Currently in my project if a user clicks buttons too quickly they will have more than one notification show at once and it is not attractive with how they are styled in my app. If you do not plan on working on this I will see if I can brew up my own solution in a few months when I have time.
The text was updated successfully, but these errors were encountered: