1.0.2修复版 增加演示
This commit is contained in:
parent
e2e84bd5e1
commit
85a578a686
@ -1,4 +1,6 @@
|
|||||||
# hotfix[查看文档](https://tyaqing.github.io/mogo-h5plus/hotfix/introduction.html)
|
# hotfix[查看文档](https://tyaqing.github.io/mogo-h5plus/hotfix/introduction.html)
|
||||||
让您的Hbuilder APP应用快速拥有更新能力.
|
让您的Hbuilder APP应用快速拥有更新能力.
|
||||||
|
|
||||||
|
## [演示APK](https://fir.im/p52j)
|
||||||
|
|
||||||
## 开发Hbuilder应用 推荐使用[MogoH5+](https://github.com/tyaqing/mogo-h5plus)
|
## 开发Hbuilder应用 推荐使用[MogoH5+](https://github.com/tyaqing/mogo-h5plus)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "h5plus-hotfix",
|
"name": "h5plus-hotfix",
|
||||||
"version": "1.0.1",
|
"version": "1.0.2",
|
||||||
"description": "让您的Hbuilder APP应用快速拥有更新能力.",
|
"description": "让您的Hbuilder APP应用快速拥有更新能力.",
|
||||||
"main": "src/hotfix.js",
|
"main": "src/hotfix.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -3,8 +3,6 @@ export default function ({ url, success, error, before, onProgress }) {
|
|||||||
if (!(url && typeof url === 'string')) throw "url 必须填写 类型为string";
|
if (!(url && typeof url === 'string')) throw "url 必须填写 类型为string";
|
||||||
if (!(success && typeof success === 'function')) throw "success必须填写 类型为function";
|
if (!(success && typeof success === 'function')) throw "success必须填写 类型为function";
|
||||||
if (!(before && typeof before === 'function')) throw "before必须填写 类型为function"
|
if (!(before && typeof before === 'function')) throw "before必须填写 类型为function"
|
||||||
if (!onProgress) onProgress = function () { };
|
|
||||||
if (!error) error = function () { };
|
|
||||||
// 对环境的要求
|
// 对环境的要求
|
||||||
let resData;
|
let resData;
|
||||||
getProperty().then((inf) => {
|
getProperty().then((inf) => {
|
||||||
@ -26,7 +24,9 @@ export default function ({ url, success, error, before, onProgress }) {
|
|||||||
return installWgt(localPath);
|
return installWgt(localPath);
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
success();
|
success();
|
||||||
}).catch(error)
|
}).catch((e) => {
|
||||||
|
error && error()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
// 下载wgt文件
|
// 下载wgt文件
|
||||||
function downWgt(url, onProgress) {
|
function downWgt(url, onProgress) {
|
||||||
@ -42,7 +42,7 @@ function downWgt(url, onProgress) {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
dtask.addEventListener("statechanged", function (task, status) {
|
dtask.addEventListener("statechanged", function (task, status) {
|
||||||
onProgress(Number.parseInt(task.downloadedSize / task.totalSize * 100));
|
onProgress && onProgress(Number.parseInt(task.downloadedSize / task.totalSize * 100));
|
||||||
});
|
});
|
||||||
dtask.start();
|
dtask.start();
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user