Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In my project I use a global variable to handle toasts. Basically, only one toast can exist at a time. So it is enough to have only one variable. When new toasts are created, something like the following happens:
Where current_toast, is the global variable. If current_toast is not undefined or null, then it exists and must be hidden so that next toast can be displayed. That is why there is the condition:
However, this causes a problem when the duration of the toast has faded. For instance, if the duration of some toast X is 2500, and if some other toast is displayed after that duration, hide() is called on a none existing object, and three errors occur. I provided patches for that in the exact places where those errors occur.
If a toast is displayed after X, but the duration of X is within 2500, that is fine. Basically, because X has not yet faded and the method hide() can safely be called.
I hope this explanation was clear :p