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 🙏

© 2026 – Pkg Stats / Ryan Hefner

page-update-checker

v0.1.0

Published

A page update detector

Downloads

4

Readme

PageUpdateChecker

一个页面更新检测器

模块化使用

import PageUpdateChecker from 'page-update-checker'

const pageUpdateChecker = new PageUpdateChecker()
pageUpdateChecker.init({
  duration: 1000 * 6, // 检测间隔时间: 6秒
  path: location.origin, // 页面路径
})

init 参数

/**
 * 页面更新检测器
 * @param {Object} option
 * @param {Number} option.duration 检测间隔时间(毫秒):默认 10秒
 * @param {String} option.path 要检测的页面路径:默认 /
 * @param {RegExp} option.scriptReg script标签正则:默认 /<script.*src="([^"]+)"/gm
 * @param {Boolean} option.test 是否开启测试模式,true会每隔duration秒调用函数 on 一次:默认 false
 * @param {Function} option.on 页面更新时的回调:默认调用 window.confirm('页面已更新,是否刷新?')
 */

html 使用示例

<!DOCTYPE html>
<html lang="en">
  <body>
    <script src="https://unpkg.com/[email protected]/dist/page-update-checker.umd.js"></script>
    <script>
      const pageUpdateChecker = new PageUpdateChecker()
      pageUpdateChecker.init({
        duration: 1000 * 2, // 2秒
        path: `${location.origin}${location.pathname}`, // 要检测的页面路径
        test: true, // 开启测试模式 会每隔duration秒调用函数 on 一次
        on: () => {
          console.log('页面有更新')
        }, // 页面更新时的回调
      })
    </script>
  </body>
</html>