以Promise风格调用: 不支持
监听向小红书后台请求检查更新结果事件。小红书在小程序每次启动(不包括热启动)时自动检查更新,不需由开发者主动触发。
function callback
属性 | 类型 | 说明 |
---|---|---|
hasUpdate | boolean | 是否有新版本 |
App({ onLaunch() { // 此处仅为效果展示,建议在app.js中的OnLaunch()中调用 const updateManager = xhs.getUpdateManager(); updateManager.onCheckForUpdate((res) => { xhs.showToast({ title: (res.hasUpdate ? "有" : "无") + "可用更新版本", icon: "none", }); }); }, });