UNPKG

@botonic/react

Version:

Build Chatbots using React

23 lines 872 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isMobileDevice = exports.isDevice = exports.DEVICES = void 0; exports.DEVICES = Object.freeze({ MOBILE: { IPHONE: 'iPhone', ANDROID: 'Android', WEBOS: 'webOS', BLACKBERRY: 'BlackBerry', WINDOWS_PHONE: 'Windows Phone', }, }); const isDevice = deviceName => { // https://stackoverflow.com/questions/19877924/what-is-the-list-of-possible-values-for-navigator-platform-as-of-today return (!!navigator.platform && navigator.platform.toLowerCase().includes(deviceName.toLowerCase())); }; exports.isDevice = isDevice; const isMobileDevice = () => { return Object.values(exports.DEVICES.MOBILE).some(deviceName => (0, exports.isDevice)(deviceName)); }; exports.isMobileDevice = isMobileDevice; //# sourceMappingURL=index.js.map