24 lines
599 B
JavaScript
Raw Normal View History

2023-08-26 18:41:06 +08:00
import { download, install } from "./updater";
export default class Updater {
static update(options ) {
// #ifdef APP-PLUS
// 静默更新
if (options.quiet) {
download({
url: options.downUrl,
onSuccess(filePath) {
2023-09-08 18:48:28 +08:00
install(filePath, false, options.versionName);
2023-08-26 18:41:06 +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
}
}