shop-applet/uni_modules/guyue-updater/index.js

24 lines
605 B
JavaScript
Raw Permalink Normal View History

2023-09-20 18:16:59 +08:00
import { download, install } from "./updater";
export default class Updater {
static async update(options ) {
// #ifdef APP-PLUS
// 静默更新
if (options.quiet) {
download({
url: options.downUrl,
onSuccess(filePath) {
install(filePath, false, options.versionName);
},
});
} else if (options.downUrl) {
uni.navigateTo({
url: `/uni_modules/guyue-updater/pages/updater?data=${encodeURIComponent(JSON.stringify(options))}`,
animationType: "fade-in",
animationDuration: 200,
});
}
// #endif
}
}