当前位置:网站首页>Applet system update prompt, and force the applet to restart and use the new version
Applet system update prompt, and force the applet to restart and use the new version
2022-07-06 22:17:00 【kaka-333】
Wechat development documents api Address :UpdateManager | Wechat open documents
app.js In file
onLaunch: function () { // Start the applet to execute once
this.getNewSystem()
}
getNewSystem() {
if (wx.canIUse('getUpdateManager')){
const updateManager = wx.getUpdateManager()// Manage applet updates
updateManager.onCheckForUpdate(function (res) {
console.log(res)
if (res.hasUpdate) {//res.hasUpdate return boolean type
updateManager.onUpdateReady(function () {
wx.showModal({
title: ' Update hints ',
content: ' The new version is ready , Restart the current application ?',
success(res) {
if (res.confirm) {
// The new version has been downloaded , call applyUpdate Apply new version and restart
updateManager.applyUpdate()
}
}
})
})
// Execute when the download of the new version fails
updateManager.onUpdateFailed(function () {
wx.showModal({
title: ' Find a new version ',
content: ' Please delete the current applet , Search again and open ...',
})
})
}
})
}else{
// If the applet needs to experience in the latest wechat version , Here are some tips
wx.showModal({
title: ' Update hints ',
content: ' Current wechat version is too low , This feature is not available , Please upgrade to the latest wechat version and try again .'
})
}
},边栏推荐
- 2022年6月国产数据库大事记-墨天轮
- HDU 2008 digital statistics
- GPS from entry to abandonment (XVII), tropospheric delay
- 图像的spatial domain 和 frequency domain 图像压缩
- GPS从入门到放弃(十六)、卫星时钟误差和卫星星历误差
- What a new company needs to practice and pay attention to
- Management background --5, sub classification
- GPS从入门到放弃(十七) 、对流层延时
- GPS从入门到放弃(十五)、DCB差分码偏差
- GPS从入门到放弃(十一)、差分GPS
猜你喜欢
![[MySQL] online DDL details](/img/7e/97098d7ed5802c446bbadaf7035981.png)
[MySQL] online DDL details

BarcodeX(ActiveX打印控件) v5.3.0.80 免费版使用

GPS from getting started to giving up (XIII), receiver autonomous integrity monitoring (RAIM)

微信红包封面小程序源码-后台独立版-带测评积分功能源码

墨西哥一架飞往美国的客机起飞后遭雷击 随后安全返航

Shell product written examination related

C#實現水晶報錶綁定數據並實現打印4-條形碼
![[leetcode daily clock in] 1020 Number of enclaves](/img/2d/3d12f20c8c73fb28044c01be633c99.jpg)
[leetcode daily clock in] 1020 Number of enclaves

Seata聚合 AT、TCC、SAGA 、 XA事务模式打造一站式的分布式事务解决方案

Assembly and interface technology experiment 5-8259 interrupt experiment
随机推荐
lora同步字设置
【MySQL】Online DDL详解
Bat script learning (I)
GNN, please deepen your network layer~
Realization of epoll reactor model
HDU 2008 数字统计
HDU 4912 paths on the tree (lca+)
Solve project cross domain problems
微信红包封面小程序源码-后台独立版-带测评积分功能源码
LeetCode刷题(十一)——顺序刷题51至55
GPS from entry to abandonment (XVII), tropospheric delay
MySQL related terms
[Yu Yue education] reference materials for surgical skills teaching in Tongji University
GPS from getting started to giving up (XI), differential GPS
2022年6月国产数据库大事记-墨天轮
小程序系统更新提示,并强制小程序重启并使用新版本
GPS from getting started to giving up (12), Doppler constant speed
搜素专题(DFS )
Insert sort and Hill sort
[sciter]: encapsulate the notification bar component based on sciter