当前位置:网站首页>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 .'
})
}
},边栏推荐
- 数据处理技巧(7):MATLAB 读取数字字符串混杂的文本文件txt中的数据
- GPS from getting started to giving up (12), Doppler constant speed
- [Chongqing Guangdong education] Tianjin urban construction university concrete structure design principle a reference
- Reset Mikrotik Routeros using netinstall
- QT | UDP broadcast communication, simple use case
- Assembly and interface technology experiment 5-8259 interrupt experiment
- HDU 2008 数字统计
- MySQL related terms
- Management background --5, sub classification
- 墨西哥一架飞往美国的客机起飞后遭雷击 随后安全返航
猜你喜欢

Unity3d Learning Notes 6 - GPU instantiation (1)

GPS从入门到放弃(十九)、精密星历(sp3格式)

二叉(搜索)树的最近公共祖先 ●●

C#实现水晶报表绑定数据并实现打印4-条形码

Management background --1 Create classification

【10点公开课】:视频质量评价基础与实践

Data processing skills (7): MATLAB reads the data in the text file TXT with mixed digital strings

关于程序员的职业操守,从《匠艺整洁之道》谈起

Shell product written examination related

C#實現水晶報錶綁定數據並實現打印4-條形碼
随机推荐
[10:00 public class]: basis and practice of video quality evaluation
[asp.net core] set the format of Web API response data -- formatfilter feature
MySQL related terms
经纪xx系统节点VIP案例介绍和深入分析异常
How does the uni admin basic framework close the creation of super administrator entries?
A Mexican airliner bound for the United States was struck by lightning after taking off and then returned safely
Unity3D学习笔记6——GPU实例化(1)
AI 企业多云存储架构实践 | 深势科技分享
What a new company needs to practice and pay attention to
GPS从入门到放弃(二十)、天线偏移
bat脚本学习(一)
Management background --4, delete classification
【10点公开课】:视频质量评价基础与实践
关于char[]数组通过scanf赋值使用上的一些问题。。
BarcodeX(ActiveX打印控件) v5.3.0.80 免费版使用
Classic sql50 questions
GPS从入门到放弃(十三)、接收机自主完好性监测(RAIM)
[Chongqing Guangdong education] Tianjin urban construction university concrete structure design principle a reference
硬件開發筆記(十): 硬件開發基本流程,制作一個USB轉RS232的模塊(九):創建CH340G/MAX232封裝庫sop-16並關聯原理圖元器件
[leetcode daily clock in] 1020 Number of enclaves