External close Toast - dismiss toast
Shaka-60hp opened this issue · 2 comments
Hi,
first of all thank you guys
I wonder if there is a way or function to dismiss the toas from outside the toast,
like the close button but external to th toast
If there is, please add the function to the documentation and some example if posible
Thanks !!
I would also like something similar.. I was wondering if you could close the toast by clicking on it? (as opposed to waiting for it to close automatically or clicking on a small close button).
I tried doing the following:
Toastify({
text: "This is a toast",
duration: 2000,
close: false,
stopOnFocus: true,
onClick: function () {
this.dismiss();
this.hide();
this.hideToast();
this.destroy();
this.close();
this.dispose();
},
}).showToast();
but there is no dismiss
function, no hide
/hideToast
/destroy
/close
/dispose
(like OP wants as well). If the function was there then the OP could probably reference the instance and call the method on it.. In my case I just want the toast the close on click...
nvm I figured it out
var toast = Toastify({
text: "This is a toast",
duration: 2000,
close: false,
stopOnFocus: true,
onClick: function () {
toast.hideToast();
},
});
toast.showToast();
so just keep the toast
reference and invoke the toast.hideToast();
when you want it to be closed.