Unique Id for Indeterminate Toast
TorreyGarland opened this issue · comments
Is there a way to uniquely identify an interdeterminate toast?
I have a potentially long running Ajax operation and I want to be able to close specific toasts, similar to the way that gritter does.
Add this to the notify function in toastr.js:
function setID() {
if (options.id)$toastElement.attr('id', options.id);
}
Then add the setID to the personalizeToast function in toastr.js:
function personalizeToast() {
setIcon();
setTitle();
setMessage();
setCloseButton();
setProgressBar();
setRTL();
setID();
setSequence();
setAria();
}
Then pass an id in the options:
toastr.options.id = guidFor({});
toastr.info('Have fun storming the castle!', 'Miracle Max Says');