materialize icon indicating copy to clipboard operation
materialize copied to clipboard

Programmatically dismissing all toast messages created by Materialize.toast(...)

Open ancientdemon opened this issue 11 years ago • 4 comments

Hello,

I am looking for a way to programmatically dismiss all toast messages created by Materialize.toast(...).

In my single page app, I want to dismiss all toasts displayed to the user when user navigates to a different page without dismissing toasts. Basically what I am looking for is a Materialize.toast.dismissAll() kind of method. I searched and looked for help but could not figure out a legitimate way to do this (discounting the hacks). Is there a way to do this, and if not, I would like to propose a feature that allows this.

Thanks

ancientdemon avatar Nov 26 '15 23:11 ancientdemon

:+1: this needs to be documented

yanickrochon avatar Sep 02 '16 15:09 yanickrochon

The implementation should return a handler as such :

const toast = Materialize.toast('I am a toast', 30000);

toast.isActive();     // true if the toast is still visible, false if it was dismissed or has timed out
toast.dismiss();      // dismiss the toast

yanickrochon avatar Sep 02 '16 15:09 yanickrochon

Any progress on this?

rohan avatar Dec 28 '16 04:12 rohan

Added in 87373d6b4551917e9b6d5b96afd031d521a8a285

Dogfalo avatar Jul 19 '17 00:07 Dogfalo