UpdateManager
The UpdateManager object, which is used to manage updates. Instances can be obtained via the Taro.getUpdateManager
API.
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).
() => 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.
(callback: OnCheckForUpdateCallback) => void
Parameter | Type | Description |
---|---|---|
callback | OnCheckForUpdateCallback | The 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).
(callback: (res: CallbackResult) => void) => void
Parameter | Type | Description |
---|---|---|
callback | (res: CallbackResult) => void | The 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.
(callback: (res: CallbackResult) => void) => void
Parameter | Type | Description |
---|---|---|
callback | (res: CallbackResult) => void | The 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
Parameter | Type |
---|---|
result | OnCheckForUpdateResult |
OnCheckForUpdateResult
Property | Type | Description |
---|---|---|
hasUpdate | boolean | Indicates whether a new version is available |