Skip to content
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

progressbar.complete() shouldn't animate unless it has been started #126

Open
javoire opened this issue Sep 23, 2016 · 0 comments
Open

progressbar.complete() shouldn't animate unless it has been started #126

javoire opened this issue Sep 23, 2016 · 0 comments

Comments

@javoire
Copy link

javoire commented Sep 23, 2016

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant