-
Notifications
You must be signed in to change notification settings - Fork 234
Open
Description
Minor enhancement that I think would improve its behaviour. Currently I start the bar if a timer exceeds 300ms, but I always complete it when a state has loaded, but I have to check the .status method to not show it unnecessarily. E.g:
const progressbarTimeouts = []; // can be more than one, in e.g. a redirect
$rootScope.$on('$stateChangeStart', () => {
progressbarTimeouts.push($timeout(() => progressbar.start(), 300));
});
$rootScope.$on('$stateChangeSuccess', () =>{
progressbarTimeouts.map((t) => $timeout.cancel(t));
if (progressbar.status() > 0) { // <--- wouldn't be needed
progressbar.complete();
}
});It's a very minor "issue" but I think it makes sense that .complete is a noop if it hasn't started. My code would then be:
const progressbarTimeouts = []; // can be more than one, in e.g. a redirect
$rootScope.$on('$stateChangeStart', () => {
progressbarTimeouts.push($timeout(() => progressbar.start(), 300));
});
$rootScope.$on('$stateChangeSuccess', () =>{
progressbarTimeouts.map((t) => $timeout.cancel(t));
progressbar.complete();
});Thoughts?
Metadata
Metadata
Assignees
Labels
No labels