@chayns-components/emoji-input
Version:
Input field that supports HTML elements and emojis
24 lines • 913 B
JavaScript
var DeviceType = /*#__PURE__*/function (DeviceType) {
DeviceType[DeviceType["Desktop"] = 0] = "Desktop";
DeviceType[DeviceType["Smartphone"] = 1] = "Smartphone";
DeviceType[DeviceType["Tablet"] = 2] = "Tablet";
return DeviceType;
}(DeviceType || {});
export 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;
};
export const getIsMacOS = () => /Mac OS X/i.test(navigator.userAgent);
export const getIsMobile = () => {
const deviceType = getDeviceType();
return deviceType === DeviceType.Smartphone || deviceType === DeviceType.Tablet;
};
//# sourceMappingURL=environment.js.map