CodeSeven / toastr

Simple javascript toast notifications
http://www.toastrjs.com
MIT License
11.98k stars 2.04k forks source link

toastr onHidden not firing when toastr.clear() or toastr.remove() is invoked. #445

Open vishnurk opened 8 years ago

vishnurk commented 8 years ago

I have a toastr notification setup with an onHidden callback.

A custom button displayed within the toastr calls toastr.clear(). However, the onHidden callback does not get called when toastr.clear or toastr.remove is called.

The out-of-the-box toastr close button dismisses the toast and triggers the onHidden callback.

So, what am i missing?

john-sanders-2 commented 8 years ago

Can you share a code snippet?

TimFerrell commented 8 years ago

What version?

vishnurk commented 8 years ago

Hi John & Tim, I am using version 2.1.1.

I've created a sample jsFiddle to demo the behavior - Run the fiddle -> Closing the toastr with the out-of-the-box close button(X) displays an alert via the associated 'onHidden' callback.

However, closing the toastr using the 'Close me' button does not display the alert.

[https://jsfiddle.net/vishnur/t8mjdrLo/11/]

bealzh commented 7 years ago

when I run toastr"success" in ajax.success, it will return history toastrs, even I call toastr.clear.

stcursi commented 6 years ago

I noticed that the onHidden callback is fired only if timeOut isn't 0. It would be useful to have a onHidden callback called when you call clear or remove with timeOut 0 and tapToDismiss false, because it is a common case of customized toast