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

[gatsby-plugin-nprogress]: Implement a delay option #3530

Closed
peduarte opened this issue Jan 15, 2018 · 3 comments
Closed

[gatsby-plugin-nprogress]: Implement a delay option #3530

peduarte opened this issue Jan 15, 2018 · 3 comments
Labels
stale? Issue that may be closed soon due to the original author not responding any more.

Comments

@peduarte
Copy link
Contributor

Allow the user to define when to display the NProgress bar, rather than it being determined by Gatsby internally.

Currently, NProgress.start() is called when Gatsby emits a onDelayedLoadPageResources event.

I think the user should be able to configure when NProgress starts. Some user may want to show it immediately (as Medium and YouTube) and some may choose to display it after 1000ms.

I think it makes more sense to tackle this once #3528 has been done, so we can hook to the new events.

How I see it working right now, would be something like this:

let timeout = null;

window.___emitter.on(`onPageLoadStarted`, () => {
  timeout = setTimeout(() => {
    NProgress.configure(pluginOptions)
    NProgress.start()
  }, pluginOptions.delay)
})

window.___emitter.on(`onPageLoadEnded`, () => {
  clearTimeout(timeout);
  NProgress.done()
})

We can define a default delay value, as we do for color.

Any alternatives or improvements on this?

Thanks!

@humphreybc
Copy link
Contributor

This would be awesome. The default delay seems to be too long, at least for us. It takes a good couple of seconds to start showing on our website. It would be awesome if we could show it immediately.

@kakadiadarpan
Copy link
Contributor

There hasn't been any activity on this issue recently. Due to the high number of incoming GitHub issues, we have to clean some of the old issues as many of them have already been resolved with the latest updates.

Please make sure to update to the latest Gatsby version and check if that solves the issue. Let us know if that works for you by adding a comment 👍

@kakadiadarpan kakadiadarpan added the stale? Issue that may be closed soon due to the original author not responding any more. label Sep 27, 2018
@kakadiadarpan
Copy link
Contributor

This issue is being closed because there hasn't been any activity for at least 30 days. Feel free to open a new one if you still experience this problem 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale? Issue that may be closed soon due to the original author not responding any more.
Projects
None yet
Development

No branches or pull requests

3 participants