The API

import {Version, params, os, browser, params, aliapp, thirdapp} from 'amfe-env';

Version

A class which could compare a string of version.

Constrcutor

new Version(ver)

create an instance of Version.

@param {string} ver - a string of version like '1.0.0';

Methods

toString()

return a string of this version.

@return {string}

gt(v)

check if is great then a giving version.

@param {string|Version} v - a string of version or an instance of Version.
@return {boolean}

gte(v)

check if is great then or equal with a giving version.

@param {string|Version} v - a string of version or an instance of Version.
@return {boolean}

lt(v)

check if is less then a giving version.

@param {string|Version} v - a string of version or an instance of Version.
@return {boolean}

lte(v)

check if is less then or equal with a giving version.

@param {string|Version} v - a string of version or an instance of Version.
@return {boolean}

eq(v)

check if is equal with a giving version.

@param {string|Version} v - a string of version or an instance of Version.
@return {boolean}

Class Methods

Version.compare(v1, v2)

compare v1 with v2.

@param {string|Version} v1 - a string of version or an instance of Version.
@param {string|Version} v2 - a string of version or an instance of Version.
@return {number} - 1 if v1 is great then v2, -1 if v1 is less then v2, 0 if v1 is equal with v2.

params

@type {object} a querystring key/value map.

os

The information of the device operating system.

os.name

@type {string} the name of os, Android/AndroidPad/iPhone/iPod/iPad/Windows Phone/unknown etc.

os.version

@type {Version} the version of os, an instance of the Version class.

os.isWindowsPhone

@type {boolean} if a Windows Phone.

os.isIPhone

@type {boolean} if an iPhone.

os.isIPad

@type {boolean} if an iPad.

os.isIOS

@type {boolean} if an iOS.

os.isAndroid

@type {boolean} if an iAndroid.

os.isAndroidPad

@type {boolean} if a AndroidPad.

browser

The information of the browser.

browser.name

@type {string} the name of the browser,UC/QQ/Firefox/Chrome/Android/Safari/iOS Webview/Chrome Webview/IE/IEMobile/unknown etc.

browser.version

@type {Version} the version of the brwoser,an instance of the Version class.

browser.isUC

@type {boolean} if a UC Browser.

browser.isQQ

@type {boolean} if a QQ Browser.

browser.isIE

@type {boolean} if a Desktop IE Browser.

browser.isIEMobile

@type {boolean} if a Mobile IE Browser.

browser.isChrome

@type {boolean} if a Mobile Chrome Browser.

browser.isFirefox

@type {boolean} if a Mobile Firefox Browser.

browser.isAndroid

@type {boolean} if a Android Browser.

browser.isSafari

@type {boolean} if a Mobile Safari Browser.

browser.isWebview

@type {boolean} if a webview inside an app.

aliapp

The information of the app from Alibaba.

aliapp.appname

@param {string} the name of the app like 'TB' or 'TB-PD' etc.

aliapp.version

@param {Version} the version of the app.

aliapp.platform

@param {string} the platform of the app. 
@see os.name

aliapp.windvane

@param {Version} the version of the WindVane sdk.

aliapp.poplayer

@param {boolean} check if a poplayer frame.

aliapp.poplayerVersion

@param {Version} the version of the poplayer frame.

thirdapp

The information of the non-ali app.

thirdapp.appname

@param {string} the name of the app.

thirdapp.isWeibo

@param {string} check if a Weibo app.

thirdapp.isWeixin

@param {string} check if a Weixin app.