当前位置:网站首页>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 .'
})
}
},
边栏推荐
- Intelligent online customer service system source code Gofly development log - 2 Develop command line applications
- C#實現水晶報錶綁定數據並實現打印4-條形碼
- make menuconfig出现recipe for target ‘menuconfig‘ failed错误
- 功能强大的国产Api管理工具
- 2022年6月国产数据库大事记-墨天轮
- GPS从入门到放弃(十一)、差分GPS
- Make menuconfig has a recipe for target 'menuconfig' failed error
- AI 企业多云存储架构实践 | 深势科技分享
- Research and investment strategy report of China's VOCs catalyst industry (2022 Edition)
- Unity3D学习笔记6——GPU实例化(1)
猜你喜欢
Hardware development notes (10): basic process of hardware development, making a USB to RS232 module (9): create ch340g/max232 package library sop-16 and associate principle primitive devices
Write a rotation verification code annotation gadget with aardio
嵌入式常用计算神器EXCEL,欢迎各位推荐技巧,以保持文档持续更新,为其他人提供便利
About the professional ethics of programmers, let's talk about it from the way of craftsmanship and neatness
ZABBIX proxy server and ZABBIX SNMP monitoring
墨西哥一架飞往美国的客机起飞后遭雷击 随后安全返航
make menuconfig出现recipe for target ‘menuconfig‘ failed错误
GPS from entry to abandonment (XVII), tropospheric delay
第4章:再谈类的加载器
CCNA-思科网络 EIGRP协议
随机推荐
Seata聚合 AT、TCC、SAGA 、 XA事务模式打造一站式的分布式事务解决方案
Mongodb (III) - CRUD
11、 Service introduction and port
Qt | UDP广播通信、简单使用案例
2021 geometry deep learning master Michael Bronstein long article analysis
功能强大的国产Api管理工具
AI 企业多云存储架构实践 | 深势科技分享
设置状态栏样式Demo
Notes de développement du matériel (10): flux de base du développement du matériel, fabrication d'un module USB à RS232 (9): création de la Bibliothèque d'emballage ch340g / max232 SOP - 16 et Associa
关于程序员的职业操守,从《匠艺整洁之道》谈起
Management background --4, delete classification
Unity3d Learning Notes 6 - GPU instantiation (1)
【MySQL】Online DDL详解
GPS从入门到放弃(十五)、DCB差分码偏差
Unity3D学习笔记6——GPU实例化(1)
GPS from getting started to giving up (12), Doppler constant speed
2500个常用中文字符 + 130常用中英文字符
GNN,请你的网络层数再深一点~
anaconda安装第三方包
搜素专题(DFS )