Skip to content

Instantly share code, notes, and snippets.

@JoshuaKGoldberg
Created December 18, 2016 05:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JoshuaKGoldberg/91b0d90f25c7bd07e97d9c9fdaa57798 to your computer and use it in GitHub Desktop.
Save JoshuaKGoldberg/91b0d90f25c7bd07e97d9c9fdaa57798 to your computer and use it in GitHub Desktop.
NProgress and RequireJS with an interval
// Start showing a progress bar
NProgress.start();
// Make the user think we're continuously making progress
const timer = setInterval(() => NProgress.inc(), 100);
// Send a network request, and when it's done, hide the bar
sendNetworkRequest().then(() => {
clearInterval(timer);
NProgress.stop();
doOtherWork();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment