universal-env
Advanced tools
Comparing version 1.0.4 to 1.0.5
@@ -5,2 +5,4 @@ "use strict"; | ||
exports.isIOS = exports.isAndroid = exports.isWeb = exports.isWechatApp = exports.isMiniApp = exports.isReactNative = exports.isWeex = exports.isNode = void 0; | ||
// compatibility taobao mp | ||
var isTaoWebview = typeof __sfc__ !== 'undefined'; | ||
var isWebPure = typeof navigator === 'object' && (navigator.appCodeName === 'Mozilla' || navigator.product === 'Gecko'); | ||
@@ -11,9 +13,10 @@ var isNode = typeof process !== 'undefined' && !!(process.versions && process.versions.node); | ||
exports.isWeex = isWeex; | ||
var isReactNative = typeof __fbBatchedBridgeConfig !== 'undefined'; | ||
var isReactNative = typeof __fbBatchedBridgeConfig !== 'undefined'; // In taobao mp'webview __sfc__ is an object | ||
exports.isReactNative = isReactNative; | ||
var isMiniApp = typeof my === 'object' && typeof my.getSystemInfo !== 'undefined'; | ||
var isMiniApp = typeof my === 'object' && typeof my.getSystemInfo !== 'undefined' || isTaoWebview; | ||
exports.isMiniApp = isMiniApp; | ||
var isWechatApp = typeof wx === 'object' && typeof wx.getSystemInfo !== 'undefined'; | ||
exports.isWechatApp = isWechatApp; | ||
var isWeb = isWebPure && !isMiniApp && !isWechatApp; | ||
var isWeb = isWebPure && !isMiniApp && !isWechatApp || isTaoWebview; | ||
exports.isWeb = isWeb; | ||
@@ -20,0 +23,0 @@ var systemInfo = {}; |
{ | ||
"name": "universal-env", | ||
"author": "rax", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"license": "BSD-3-Clause", | ||
@@ -6,0 +6,0 @@ "main": "lib/index.js", |
@@ -7,3 +7,4 @@ // https://www.w3.org/TR/html5/webappapis.html#dom-navigator-appcodename | ||
declare const wx: any; | ||
// compatibility taobao mp | ||
const isTaoWebview = typeof __sfc__ !== 'undefined'; | ||
const isWebPure: boolean = typeof navigator === 'object' && (navigator.appCodeName === 'Mozilla' || navigator.product === 'Gecko'); | ||
@@ -13,6 +14,8 @@ export const isNode: boolean = typeof process !== 'undefined' && !!(process.versions && process.versions.node); | ||
export const isReactNative: boolean = typeof __fbBatchedBridgeConfig !== 'undefined'; | ||
export const isMiniApp: boolean = typeof my === 'object' && typeof my.getSystemInfo !== 'undefined'; | ||
// In taobao mp'webview __sfc__ is an object | ||
export const isMiniApp: boolean = typeof my === 'object' && typeof my.getSystemInfo !== 'undefined' || isTaoWebview; | ||
export const isWechatApp: boolean = typeof wx === 'object' && typeof wx.getSystemInfo !== 'undefined'; | ||
export const isWeb: boolean = isWebPure && !isMiniApp && !isWechatApp; | ||
export const isWeb: boolean = isWebPure && !isMiniApp && !isWechatApp || isTaoWebview; | ||
let systemInfo: any = {}; | ||
@@ -19,0 +22,0 @@ if (isMiniApp) { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
12234
191