24 lines
627 B
JavaScript
Raw Permalink Normal View History

2024-03-19 16:23:42 +08:00
import { download, install } from "./updater";
export default class Updater {
2024-03-26 16:55:50 +08:00
static async update(options) {
2024-03-19 16:23:42 +08:00
// #ifdef APP-PLUS
// 静默更新
if (options.quiet) {
download({
url: options.downUrl,
onSuccess(filePath) {
2024-03-26 16:55:50 +08:00
install(filePath, options.quiet&&options.force, options.versionName);
2024-03-19 16:23:42 +08:00
},
});
} else if (options.downUrl) {
uni.navigateTo({
url: `/uni_modules/guyue-updater/pages/updater?data=${encodeURIComponent(JSON.stringify(options))}`,
animationType: "fade-in",
animationDuration: 200,
});
}
// #endif
}
}