|
@@ -1,16 +1,19 @@
|
|
|
/* @flow */
|
|
/* @flow */
|
|
|
|
|
+declare var WXEnvironment: any;
|
|
|
|
|
|
|
|
// can we use __proto__?
|
|
// can we use __proto__?
|
|
|
export const hasProto = '__proto__' in {}
|
|
export const hasProto = '__proto__' in {}
|
|
|
|
|
|
|
|
// Browser environment sniffing
|
|
// Browser environment sniffing
|
|
|
export const inBrowser = typeof window !== 'undefined'
|
|
export const inBrowser = typeof window !== 'undefined'
|
|
|
|
|
+export const inWeex = typeof WXEnvironment !== 'undefined' && !!WXEnvironment.platform
|
|
|
|
|
+export const weexPlatform = inWeex && WXEnvironment.platform.toLowerCase()
|
|
|
export const UA = inBrowser && window.navigator.userAgent.toLowerCase()
|
|
export const UA = inBrowser && window.navigator.userAgent.toLowerCase()
|
|
|
export const isIE = UA && /msie|trident/.test(UA)
|
|
export const isIE = UA && /msie|trident/.test(UA)
|
|
|
export const isIE9 = UA && UA.indexOf('msie 9.0') > 0
|
|
export const isIE9 = UA && UA.indexOf('msie 9.0') > 0
|
|
|
export const isEdge = UA && UA.indexOf('edge/') > 0
|
|
export const isEdge = UA && UA.indexOf('edge/') > 0
|
|
|
-export const isAndroid = UA && UA.indexOf('android') > 0
|
|
|
|
|
-export const isIOS = UA && /iphone|ipad|ipod|ios/.test(UA)
|
|
|
|
|
|
|
+export const isAndroid = (UA && UA.indexOf('android') > 0) || (weexPlatform === 'android')
|
|
|
|
|
+export const isIOS = (UA && /iphone|ipad|ipod|ios/.test(UA)) || (weexPlatform === 'ios')
|
|
|
export const isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge
|
|
export const isChrome = UA && /chrome\/\d+/.test(UA) && !isEdge
|
|
|
|
|
|
|
|
// Firefox has a "watch" function on Object.prototype...
|
|
// Firefox has a "watch" function on Object.prototype...
|