Skip to main content
Version: Next

UpdateManager

The UpdateManager object, which is used to manage updates. Instances can be obtained via the Taro.getUpdateManager API.

Reference

Methods

applyUpdate

Forces a Mini Program to restart and update to the latest version. This API is called after the new Mini Program version is downloaded (i.e., when the onUpdateReady callback is received).

Reference

() => void

onCheckForUpdate

Listens on the event that a request for checking for updates is sent to the WeChat backend. WeChat automatically checks for updates when the Mini program cold starts. The developer does not need to trigger this method.

Reference

(callback: OnCheckForUpdateCallback) => void
ParameterTypeDescription
callbackOnCheckForUpdateCallbackThe callback function for the event that a request for checking for updates is sent to the WeChat backend.

onUpdateFailed

Listens on Mini Program update failure event. The app, instead of the developer, triggers the download when a newer version is available. A callback is performed when the download fails (probably due to network problems).

Reference

(callback: (res: CallbackResult) => void) => void
ParameterTypeDescription
callback(res: CallbackResult) => voidThe callback function for Mini Program update failure event.

onUpdateReady

Listens on the event that a newer Mini Program version is available. The app, instead of the developer, triggers the download. A callback is performed after successful download.

Reference

(callback: (res: CallbackResult) => void) => void
ParameterTypeDescription
callback(res: CallbackResult) => voidThe callback function for the event that a newer Mini Program version is available.

Parameter

OnCheckForUpdateCallback

The callback function for the event that a request for checking for updates is sent to the WeChat backend.

(result: OnCheckForUpdateResult) => void
ParameterType
resultOnCheckForUpdateResult

OnCheckForUpdateResult

PropertyTypeDescription
hasUpdatebooleanIndicates whether a new version is available