Skip to main content
Version: 3.x

Taro.getUpdateManager()

Obtains the globally unique version update manager, which is used to manage Mini Program updates. For more information about the Mini Program update mechanism, see the Operating Mechanism documentation.

Reference

Type

() => UpdateManager

Parameters

Sample Code

const updateManager = Taro.getUpdateManager()
updateManager.onCheckForUpdate(function (res) {
console.log(res.hasUpdate)
})
updateManager.onUpdateReady(function () {
Taro.showModal({
title: 'Update Tips',
content: 'The new version is ready, is the app restarted?',
success: function (res) {
if (res.confirm) {
// The new version has been downloaded, call applyUpdate to apply the new version and restart.
updateManager.applyUpdate()
}
}
})
})
updateManager.onUpdateFailed(function () {
// Download of the new version has failed
})

API Support

APIWeChat Mini-ProgramH5React Native
Taro.getUpdateManager✔️