23 lines
628 B
JavaScript
23 lines
628 B
JavaScript
"use strict";
|
|
const common_vendor = require("../vendor.js");
|
|
function CheckUpdate() {
|
|
const updateManager = common_vendor.index.getUpdateManager();
|
|
updateManager.onCheckForUpdate(function(res) {
|
|
console.log(res.hasUpdate);
|
|
});
|
|
updateManager.onUpdateReady(function() {
|
|
common_vendor.index.showModal({
|
|
title: "更新提示",
|
|
content: "新版本已经准备好,是否重启应用?",
|
|
success: function(res) {
|
|
if (res.confirm) {
|
|
updateManager.applyUpdate();
|
|
}
|
|
}
|
|
});
|
|
});
|
|
updateManager.onUpdateFailed(function() {
|
|
});
|
|
}
|
|
exports.CheckUpdate = CheckUpdate;
|