GithubHelp home page GithubHelp logo

check-dist-update's Introduction

check-dist-update

English | 中文文档

A simple tool to check dist version update

This is a tool to detect the change of dist version by detecting the updates of js and css file signature values referenced by the entrance page file in dist constructed by webpack, vite, etc

Install

npm install check-dist-update
yarn add check-dist-update
pnpm add check-dist-update

Usage

  • import
import { checkUpdate, cancelDetect } from 'check-dist-update'

checkUpdate({
  url: `${location.origin}/index.html`,
  loop: 1000 * 60,
  init: 1000 * 10,
  cb: () => {},
  cacheKey: 'last_signature'
})

// cancel detection
setTimeout(() => {
  cancelDetect()
}, 1000 * 60)
  • require
const check = require('check-dist-update')

check.checkUpdate({
  url: `${location.origin}/index.html`,
  loop: 1000 * 60,
  init: 1000 * 10,
  cb: () => {},
  cacheKey: 'last_signature'
})

// cancel detection
setTimeout(() => {
  check.cancelDetect()
}, 1000 * 60)

checkUpdate params config

name description type default
init Initial request interval number 10000
loop Loop request interval number 60000
url Detection address URL string ${location.origin}/index.html
cb Detects update callback function function () => {}
cacheKey Cached Key string last_signature

Thanks

This tool is affected by version polling. Thank you very much for your inspiration!

check-dist-update's People

Contributors

swsjtx avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.