title: UpdateManager

sidebar_label: 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

  1. () => 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

  1. (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).

Reference

  1. (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.

Reference

  1. (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.

  1. (result: OnCheckForUpdateResult) => void
Parameter Type
result OnCheckForUpdateResult

OnCheckForUpdateResult

Property Type Description
hasUpdate boolean Indicates whether a new version is available