mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2024-11-23 23:57:55 -05:00
15 lines
595 B
JavaScript
15 lines
595 B
JavaScript
import bowser from 'bowser';
|
|
import OS_ENUM from './os-enum.js';
|
|
|
|
/**
|
|
* Helper function to the current Operating System.
|
|
* @returns {OS_ENUM} Returns the OS value, defaults to WINDOWS
|
|
*/
|
|
export default function () {
|
|
// matching OS strings from https://github.com/lancedikson/bowser/blob/master/src/constants.js
|
|
if (bowser.osname === 'macOS') return OS_ENUM.MACOS;
|
|
if (bowser.osname === 'Chrome OS') return OS_ENUM.CHROMEOS;
|
|
if (bowser.osname === 'Android') return OS_ENUM.ANDROID;
|
|
// if (bowser.osname === 'iOS') return OS_ENUM.IOS; // @todo
|
|
return OS_ENUM.WINDOWS;
|
|
}
|