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');
});