-
Notifications
You must be signed in to change notification settings - Fork 275
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding a "refresh timer" to the scope #179
Conversation
A toast is an alert, to say something, for me, it doesn't make sense to restart the timer. If an user needs to read it, they can hover it so it doesn't go away. |
My use case is uploading multiple files. Instead of opening a screen full of toasts to announce that each uploaded successfully, I'm showing one toast and if it's still visible when the next file finishes, I'm updating the message and resetting the timer. |
I get you. I will think about that. |
Do you know of any other way to accomplish what I'm trying? Currently, the toast continues to update until it times out and then another one immediately pops up with a new timer. It works okay, but the flicker when it has to pop a new toast is just a bit ugly. |
I would make a permanent toast for the time being and after all upload finishes, kill the toast. |
Yes that would sort of work. Except then if there were only a few small files, the toast would disappear too quickly. |
I want this option, but having a method in the current scope is just one step, To access it you need to Also, I need tests. |
I agree about having to go through the scope property to refresh the timer. To be consistent with the rest of the API, it should probably go through the service like |
Perhaps just "restart"? |
Could that give the impression it affects more than just the timer? |
You are right. Then |
I'll just keep refreshTimeout for maximum clarity. Another topic: Tests are in toastr_spec.js but I haven't figured out how to run them locally. |
For the tests, you need to run testem. I need to swap that for karma. So for today:
The tests will watch any change that comes from |
Nice work on that, but we would need a few more tests cases where the toast is not there (long gone) and one where the toast was just gone one millisecond ago. |
Will do. |
Are the tests sufficient? Are there any other test cases needed? |
Probably yes. Will double check tomorrow and release this weekend :) |
Thanks, I merged this. I will make a release. |
Adding a method to restart the timeout timer to keep a toast visible longer.