UNPKG

@chayns-components/emoji-input

Version:
33 lines (32 loc) 1.15 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getIsMobile = exports.getIsMacOS = exports.getDeviceType = void 0; var DeviceType = /*#__PURE__*/function (DeviceType) { DeviceType[DeviceType["Desktop"] = 0] = "Desktop"; DeviceType[DeviceType["Smartphone"] = 1] = "Smartphone"; DeviceType[DeviceType["Tablet"] = 2] = "Tablet"; return DeviceType; }(DeviceType || {}); const getDeviceType = () => { const { userAgent } = navigator; if (/Mobile|Android|iP(hone|od)|IEMobile|BlackBerry|Kindle|Silk-Accelerated|(hpw|web)OS|Opera M(obi|ini)/.test(userAgent)) { return DeviceType.Smartphone; } if (/(tablet|ipad|playbook|silk)|(android(?!.*mobi))/i.test(userAgent)) { return DeviceType.Tablet; } return DeviceType.Desktop; }; exports.getDeviceType = getDeviceType; const getIsMacOS = () => /Mac OS X/i.test(navigator.userAgent); exports.getIsMacOS = getIsMacOS; const getIsMobile = () => { const deviceType = getDeviceType(); return deviceType === DeviceType.Smartphone || deviceType === DeviceType.Tablet; }; exports.getIsMobile = getIsMobile; //# sourceMappingURL=environment.js.map