UNPKG

uni-update-check

Version:

跨端(微信小程序 & App)的一体化版本更新检查工具,用于uni-app项目。支持wgt热更新、APK整包更新、iOS商店跳转以及小程序原生更新。

30 lines (25 loc) 657 B
'use strict'; function compareVersion(v1, v2) { if (!v1 || !v2) return false; const a1 = String(v1).split('.').map(n => parseInt(n || 0, 10)); const a2 = String(v2).split('.').map(n => parseInt(n || 0, 10)); const len = Math.max(a1.length, a2.length); for (let i = 0; i < len; i++) { const x = a1[i] || 0; const y = a2[i] || 0; if (x > y) return true; if (x < y) return false; } return false; } function isWeApp() { return typeof wx !== 'undefined' && !!wx.getUpdateManager; } function isAppPlus() { return typeof plus !== 'undefined' && !!plus.runtime; } module.exports = { compareVersion, isWeApp, isAppPlus };