import Device from '@mobilizing/library/js/Mobilizing/core/util/Device.js'
Device
Device class gives easy access to some device information such as the operating system and browser used
Example:
Mobilizing.Device.getOS();
Static Method Summary
Static Public Methods | ||
public static | getBrowser(): String Get the name of the web browser | |
public static | Get the major version number of the web browser | |
public static | Get the version of the web browser | |
public static | Get the framework the html page is running under (ejecta or cordova), if any | |
public static | Get the operating system's type | |
public static | Get the operating system's version | |
public static | Get the screen's height This does not necessarily indicate the height available Some of the screen's height might be used by browser widgets and scrollbars | |
public static | Shortcut to {{#crossLink "Device/getScreenWidth:method"}}{{/crossLink}} and {{#crossLink "Device/getScreenHeight:method"}}{{/crossLink}} | |
public static | Get the screen's width This does not necessarily indicate the width available Some of the screen's width might be used by browser widgets and scrollbars | |
public static | Get the device type | |
public static | getUUID(): * |
Static Private Methods | ||
private static | Parse browser data from navigator.appName, navigator.userAgent and navigator.appVersion Credit goes to http://stackoverflow.com/questions/9514179/how-to-find-the-operating-system-version-using-javascript | |
private static | Parse OS data from navigator.userAgent and navigator.appVersion Credit goes to http://stackoverflow.com/questions/9514179/how-to-find-the-operating-system-version-using-javascript |
Static Public Methods
public static getBrowser(): String source
Get the name of the web browser
Return:
String | The browser's name |
public static getBrowserMajorVersion(): Number source
Get the major version number of the web browser
Return:
Number | The browser's major version |
public static getBrowserVersion(): String source
Get the version of the web browser
Return:
String | The browser's version |
public static getFramework(): String source
Get the framework the html page is running under (ejecta or cordova), if any
Return:
String | The framework's name, or null if none |
public static getOS(): String source
Get the operating system's type
Return:
String | The OS type (Windows, Mac OS X, Android, iOS, etc) |
public static getOSVersion(): String source
Get the operating system's version
Return:
String | The OS version |
public static getScreenHeight(): Number source
Get the screen's height This does not necessarily indicate the height available Some of the screen's height might be used by browser widgets and scrollbars
Return:
Number | The screen's height in pixels |
public static getScreenSize(): Object source
Shortcut to {{#crossLink "Device/getScreenWidth:method"}}{{/crossLink}} and {{#crossLink "Device/getScreenHeight:method"}}{{/crossLink}}
Return:
Object | An object with "width" and "height" as keys representing the screen's dimensions |
public static getScreenWidth(): Number source
Get the screen's width This does not necessarily indicate the width available Some of the screen's width might be used by browser widgets and scrollbars
Return:
Number | The screen's width in pixels |
public static getType(): String source
Get the device type
Return:
String | The device type (mobile or desktop) |
public static getUUID(): * source
Return:
* |
Static Private Methods
private static parseBrowserData() source
Parse browser data from navigator.appName, navigator.userAgent and navigator.appVersion Credit goes to http://stackoverflow.com/questions/9514179/how-to-find-the-operating-system-version-using-javascript
private static parseOSData() source
Parse OS data from navigator.userAgent and navigator.appVersion Credit goes to http://stackoverflow.com/questions/9514179/how-to-find-the-operating-system-version-using-javascript