当前位置:网站首页>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 .'
})
}
},
边栏推荐
猜你喜欢
GPS from getting started to giving up (16), satellite clock error and satellite ephemeris error
GPS from getting started to giving up (12), Doppler constant speed
2021 geometry deep learning master Michael Bronstein long article analysis
AI 企业多云存储架构实践 | 深势科技分享
AI enterprise multi cloud storage architecture practice | Shenzhen potential technology sharing
二叉(搜索)树的最近公共祖先 ●●
About the professional ethics of programmers, let's talk about it from the way of craftsmanship and neatness
GPS从入门到放弃(十五)、DCB差分码偏差
A Mexican airliner bound for the United States was struck by lightning after taking off and then returned safely
GPS从入门到放弃(十九)、精密星历(sp3格式)
随机推荐
第4章:再谈类的加载器
数据处理技巧(7):MATLAB 读取数字字符串混杂的文本文件txt中的数据
【sciter Bug篇】多行隐藏
[asp.net core] set the format of Web API response data -- formatfilter feature
Assembly and Interface Technology Experiment 6 - ADDA conversion experiment, AD acquisition system in interrupt mode
Maximum product of three numbers in question 628 of Li Kou
Embedded common computing artifact excel, welcome to recommend skills to keep the document constantly updated and provide convenience for others
Is it important to build the SEO foundation of the new website
lora同步字设置
2500个常用中文字符 + 130常用中英文字符
Seata聚合 AT、TCC、SAGA 、 XA事务模式打造一站式的分布式事务解决方案
Insert sort and Hill sort
[sdx62] wcn685x will bdwlan Bin and bdwlan Txt mutual conversion operation method
嵌入式常用计算神器EXCEL,欢迎各位推荐技巧,以保持文档持续更新,为其他人提供便利
GPS from getting started to giving up (XIII), receiver autonomous integrity monitoring (RAIM)
Management background --4, delete classification
[MySQL] online DDL details
Mysql相关术语
设置状态栏样式Demo
2500 common Chinese characters + 130 common Chinese and English characters