H5 page checks for updates and alerts; Depends on manifest.json.
npm install h5-check-update
In src/main.js
or src/index.js
add the following code
import "h5-check-update";
Save check_update.worker.js
to the project root directory
import { checkUpdate, destroy } from "h5-check-update";
Check for updates; In general, you don't need to call this function, it is automatically called once when you introduce the file
Stop checking for updates, close the worker, and free up resources.
Add the following code to the scripts
in package.json
:
"update": "h5-check-update update"
Optional parameters: --publicDir=public
、--version=1.0.0
-
--publicDir=x
: Directory of the generated manifest.json file. -
--version=0.0.1
: version; Defaults is the last version number plus 1.
Import h5-check-update
、add check_update.worker.js
、add update
scripts.
例如:
h5-check-update init