h5-check-update
Version:
H5 page checks for updates and alerts
38 lines (22 loc) • 876 B
Markdown
# h5-check-update
[中文文档](https://gitee.com/towardly/ph/blob/master/packages/h5-update/README.zh.md)
H5 page checks for updates and alerts; The implementation detects changes in the hash of the index.js file introduced by the source server.
## Install
```shell
npm install h5-check-update
```
## Usage
Use [vite's Web Workers import](https://cn.vite.dev/guide/features.html#web-workers) feature for quick integration.
### Usage
In `src/main.js` or `src/index.js` add the following code
```javascript
import "h5-check-update";
```
## Methods
```javascript
import { checkUpdate, destroy } from "h5-check-update";
```
### 1. `checkUpdate()`
Check for updates; In general, you don't need to call this function, it is automatically called once when you introduce the file
### 2. `destroy()`
Stop checking for updates, close the worker, and free up resources.