CodeSeven/toastr — pull request #25 by jpino (2012-10-24 03:40:52+00:00)
Title: Add toastr.clear() method

Not sure if this is worth pulling but it was useful to me!

This new method clears all currently displayed notifications. I needed that functionality to properly display errors during form validation because validation errors must not disappear by themselves (achieved with {timeOut: 0}), but must be cleared when they are not relevant anymore.

For example, if I toast an 'Email not valid' error, then the user fix the email and enters an invalid date, the previous email toast would still be there next to the new 'Invalid date'.

Now I just clear all toasts wherever the next toast is meant to be the only one (or the first one) displayed:

toastr.clear()
toastr.error('The battle of wits has begun.')

I also updated the demo and the readme file.