Open DavidRogersDev opened 2 years ago
Have you tried looking at the code on the demo page. There is a black/gray bar in the bottomif you click on it you'll see what they call glimpse. If you fire a toast you will see it appear in the glimpse, you'll also see it there when it dissappears. This javascript file has some features which may help you for example
toastr.subscribe(receiveToasts);
function receiveToasts(args) {
var data = args;
!rendered ? preexistingToasts.push(data) : write(data);
}
By subscribing a function to the toast it'll trigger on completion. I have my doubts if this works onclick though.
The code in the function pushes the toast to the preexistingToasts when its not being rendered anymore. I hope this hint can help you achieve your goal (this isn't a complete tutorial i suggest reading and understanding the code in the javascript file).
It would be good if the onHidden callback passed a parameter enabling the executing code to identify which Toast was being hidden.
Currently, there's no way to correlate a toast that is hiding/hidden.
In the scenario I am facing, I am pushing each message into a MessageBoard at the top of the page as the onHidden handler fires. But they may hide in a different order that that in which they are launched. For example, a user may hover over one Toast, meaning that a Toast which came after it hides before it.
This messes up the order in which messages are added to the message board.
As a work around, I'm now adding them to the board as the Toast is launched. But it would be more elegant to add it when the Toast disappears.
Cheers