UpdateManager.onUpdateReady
Introduction
Listen for the event when a new version of the mini-program is ready to be applied. The client actively triggers the download (without the need for the developer to trigger it), and when the download is successful, this callback is executed.
Parameters
None
Sample Code
Page({
onLoad() {
const updateManager = dlt.getUpdateManager();
updateManager.onUpdateReady(function (res) {
dlt.showModal({
title: 'Update Prompt',
content:
'A new version is ready. Would you like to restart the application?',
success: function (res) {
if (res.confirm) {
// The new version has been downloaded and is ready to be applied, call applyUpdate to apply the new version and restart the application
updateManager.applyUpdate();
}
},
});
});
},
});