notyf icon indicating copy to clipboard operation
notyf copied to clipboard

[Feature Request] No stacking notifications

Open chrisleekr opened this issue 3 years ago • 4 comments

First of all, this notification project is very easy to use and pretty CSS. I just started using it for my project.

I just have one feature that I want to have is, not stacking the notifications. When there is a new notification, I want to replace the current notification and display a new one.

Workaround for this feature is using dismissAll(), but it still makes stacking notifications before dismissing an old notification.

Demo: https://jsfiddle.net/2jg0wv4m/

Is there an alternative way to replace opened notification?

chrisleekr avatar May 28 '21 04:05 chrisleekr

Hi @caroso1222

I actually updated your code to have a new option maxStack. Could you take a look? https://github.com/caroso1222/notyf/pull/105

chrisleekr avatar May 28 '21 05:05 chrisleekr

Thanks for bringing this to my attention, @chrisleekr. A few things come to my mind:

  • What happens when you want to launch a new notification after the max stack has been reached? does notyf show it, or dismiss it?
  • Can you please update the jsfiddle? I see it empty

caroso1222 avatar May 28 '21 16:05 caroso1222

@caroso1222

What happens when you want to launch a new notification after the max stack has been reached? does notyf show it, or dismiss it?

  • I found simply removing the last notification from the DOM works as expected. And then display a new notification.
  • https://github.com/caroso1222/notyf/pull/105/files#diff-4b2fa43eb39ef49cb0f3bf51b34c98414b01e75f395e92f1a85afde93bf54aefR90

Can you please update the jsfiddle? I see it empty

  • Oh, whoops. I forgot what I wrote at that time. But doesn't really matter because PR would explain what I wanted.

chrisleekr avatar May 29 '21 12:05 chrisleekr

Hi,

There is any method that clear all before show new notification (or a parameter)?

Thanks.

paulocoutinhox avatar Apr 05 '22 07:04 paulocoutinhox