New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

page-update-checker

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

page-update-checker

A page update detector

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

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/page-update-checker@0.0.3/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>

Keywords

FAQs

Package last updated on 19 Dec 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc