UpdateManager.applyUpdate
Introduction
Forcefully restart the mini-program and use the new version. This should be called after the new version of the mini-program has been downloaded (i.e., when the onUpdateReady
callback is received).
Parameters
None
Sample Code
Page({
onLoad() {
const updateManager = dlt.getUpdateManager();
updateManager.onUpdateReady(function () {
dlt.showModal({
title: 'Update Prompt',
content:
'A new version is ready. Do you want to restart the application?',
success: function (res) {
if (res.confirm) {
// The new version is downloaded and ready; call applyUpdate to apply the new version and restart.
updateManager.applyUpdate();
}
},
});
});
},
});