当前位置:网站首页>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 .'
})
}
},边栏推荐
- Shortcut keys in the terminal
- GPS from getting started to giving up (19), precise ephemeris (SP3 format)
- 图像的spatial domain 和 frequency domain 图像压缩
- 十二、启动流程
- BarcodeX(ActiveX打印控件) v5.3.0.80 免费版使用
- LeetCode刷题(十一)——顺序刷题51至55
- 设置状态栏样式Demo
- 经纪xx系统节点VIP案例介绍和深入分析异常
- Leetcode learning records (starting from the novice village, you can't kill out of the novice Village) ---1
- RESNET rs: Google takes the lead in tuning RESNET, and its performance comprehensively surpasses efficientnet series | 2021 arXiv
猜你喜欢

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

Classic sql50 questions

Management background --2 Classification list
![[MySQL] online DDL details](/img/7e/97098d7ed5802c446bbadaf7035981.png)
[MySQL] online DDL details

About the professional ethics of programmers, let's talk about it from the way of craftsmanship and neatness

2500 common Chinese characters + 130 common Chinese and English characters

How does the uni admin basic framework close the creation of super administrator entries?

【数字IC手撕代码】Verilog无毛刺时钟切换电路|题目|原理|设计|仿真
![[leetcode daily clock in] 1020 Number of enclaves](/img/2d/3d12f20c8c73fb28044c01be633c99.jpg)
[leetcode daily clock in] 1020 Number of enclaves

AI enterprise multi cloud storage architecture practice | Shenzhen potential technology sharing
随机推荐
MySQL related terms
Codeforces Round #274 (Div. 2) –A Expression
图像的spatial domain 和 frequency domain 图像压缩
Earned value management EVM detailed explanation and application, example explanation
MariaDB database management system learning (I) installation diagram
UNI-Admin基础框架怎么关闭创建超级管理员入口?
CCNA-思科网络 EIGRP协议
MariaDb数据库管理系统的学习(一)安装示意图
C#实现水晶报表绑定数据并实现打印4-条形码
Seata聚合 AT、TCC、SAGA 、 XA事务模式打造一站式的分布式事务解决方案
About the professional ethics of programmers, let's talk about it from the way of craftsmanship and neatness
A Mexican airliner bound for the United States was struck by lightning after taking off and then returned safely
lora同步字设置
Qt | UDP广播通信、简单使用案例
[Yu Yue education] reference materials for surgical skills teaching in Tongji University
HDU 2008 digital statistics
AI enterprise multi cloud storage architecture practice | Shenzhen potential technology sharing
保存和检索字符串
BarcodeX(ActiveX打印控件) v5.3.0.80 免费版使用
Assembly and Interface Technology Experiment 6 - ADDA conversion experiment, AD acquisition system in interrupt mode