Update
my.getUpdateManager
Get the update manager for handling app updates.
Get an UpdateManager instance to manage Mini Program updates.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Get the update manager for handling app updates.
| Method | Description |
|---|---|
| onCheckForUpdate(callback) | Called when update check completes |
| onUpdateReady(callback) | Called when new version is downloaded |
| onUpdateFailed(callback) | Called when update download fails |
| applyUpdate() | Force apply and restart with new version |
const updateManager = my.getUpdateManager();
updateManager.onCheckForUpdate((res) => {
console.log('Has update:', res.hasUpdate);
});
updateManager.onUpdateReady(() => {
my.confirm({
title: 'Update Available',
content: 'Restart to apply the new version?',
success: (res) => {
if (res.confirm) {
updateManager.applyUpdate();
}
}
});
});
updateManager.onUpdateFailed(() => {
console.log('Update download failed');
});