npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

page-load-progress

v0.0.6

Published

Listening to hyperlink loading progress

Readme

Page-Load-Progress

Let traditional ordinary websites have page loading progress when clicking a tag to jump pages

preview demo

Installation

Add page-load-progress.js to your project.

<script src="https://cdn.jsdelivr.net/npm/page-load-progress/page-load-progress.min.js"></script>

Or

npm install page-load-progress

Basic usage

Just listen to progress:start and progress:end to control the progress

// Triggered when the a tag on the page is clicked
document.addEventListener('progress:start', () => {
  console.log('start')
})

// Triggered when the html file for the a tag is loaded
document.addEventListener('progress:end', () => {
  console.log('end')
})

// Triggered when the html file of the a tag is loaded incorrectly
document.addEventListener('progress:error', () => {
  console.log('error')
})

// When you need to filter some links that don't need a progress bar
pageLoadProgress({ ignoreKeywords: ['/logout'] })

// default: 500ms
// Delay the execution of the page jump when the `progress:end` event is triggered (used to wait for the progress bar to reach 100% animation effect)
pageLoadProgress({ defer: 500 })

Add progress bar

Use NProgress.js

// Triggered when the a tag on the page is clicked
document.addEventListener('progress:start', () => {
  NProgress.start()
})

// Triggered when the html file for the a tag is loaded
document.addEventListener('progress:end', () => {
  NProgress.done()
})

Here's a simple example of a progress bar

!(function () {
  var style = document.createElement('style')
  style.textContent = `
    .__progress__ {
        top: 0; 
        left: 0;
        position: fixed;
        width: 10%;
        height: 2px;
        z-index: 103;
        background-color: #e58a8a;
        transition: width 0.4s ease 0s;
    }`
  document.head.appendChild(style)

  var timer = null
  document.addEventListener('progress:start', () => {
    var progress = 10
    var div = document.createElement('div')
    div.className = '__progress__'
    document.body.prepend(div)
    var max = 10,
      mini = 3
    var result = max - mini
    timer = setInterval(function () {
      var num = parseInt(Math.random() * result)
      var randomResult = num + mini
      progress += randomResult
      if (progress > 95) progress = 95
      div.style.width = progress + '%'
    }, 500)
  })

  document.addEventListener('progress:end', () => {
    clearInterval(timer)
    var progress = document.querySelector('.__progress__')
    if (progress) progress.style.width = '100%'
    setTimeout(() => {
      progress.parentElement.removeChild(progress)
    }, 500)
  })
})()