2017-02-02 09:45:34 -06:00
|
|
|
/* @flow */
|
|
|
|
|
|
2017-01-15 12:09:52 -06:00
|
|
|
const userAgent = navigator.userAgent;
|
|
|
|
|
let OS;
|
|
|
|
|
|
|
|
|
|
if (userAgent.match(/Android/i)) {
|
|
|
|
|
OS = 'android';
|
|
|
|
|
} else if (userAgent.match(/iP(ad|hone|od)/i)) {
|
|
|
|
|
OS = 'ios';
|
2017-02-27 21:22:32 -06:00
|
|
|
} else if (userAgent.match(/Mac(intosh| OS X)/i)) {
|
|
|
|
|
OS = 'macos';
|
|
|
|
|
} else if (userAgent.match(/Windows/i)) {
|
2017-02-16 14:00:54 -06:00
|
|
|
OS = 'windows';
|
2017-01-15 12:09:52 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Provides a minimal equivalent of react-native's Platform abstraction.
|
|
|
|
|
*/
|
|
|
|
|
export default {
|
|
|
|
|
/**
|
|
|
|
|
* The operating system on which the application is executing.
|
|
|
|
|
*
|
|
|
|
|
* @type {string}
|
|
|
|
|
*/
|
|
|
|
|
OS
|
|
|
|
|
};
|