cgross / angular-busy

Show busy/loading indicators on any element during $http requests (or any promise).
http://cgross.github.io/angular-busy/demo
MIT License
1.44k stars 256 forks source link

Fix for delay+minDuration always showing busy #45

Closed amunar closed 9 years ago

amunar commented 10 years ago

I was having issues using these settings together. When I set a promise, after the delay time, the busy screen would show for minDuration regardless of how fast the promise resolved.. For example, setting a delay of 5000 and a minDuration of 5000 meant that after 5 seconds, the busy screen would show for 5 seconds.

cgross commented 10 years ago

Thats a feature ;)

The behavior was actually changed in the latest release to do exactly that. On the release notes section of the readme you'll see it. The idea is that the minDuration is there so the user will see a reasonable animation even if the duration of the promise is short. So instead of seeing a busy message start to animate in and then animate out before it even finishes, they'll see the whole thing animate in and then animate out in a more predicable manner. In other words, the minDuration should always be the minimum time to see the UI anytime the UI is shown (delayed or not).

amunar commented 10 years ago

Sorry, I worded that incorrectly. What I meant was that even if the promise beat the delay, the indicator would still show after the delay when I would not expect it to according to "... if delay=200 and minDuration=500 and the actual promise only took 100ms, no indicator will be shown."

cgross commented 10 years ago

Ah ok. I'll take a closer look tomorrow.