UNPKG

@upendradevsingh/webcore

Version:
43 lines (37 loc) 1.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); /** * ======================================================= * WebCore: browser.js 1.0.0 * https://webcore.jabong.com/utils/browser * ======================================================= * * Copyright 2017 Jabong, Inc. * Licensed under MIT (https://github.com/jabong/webcore/blob/master/LICENSE) */ var Configuration = { MOBILE_DEVICE_WIDTH: 767 }; var device = { /** * * * @returns boolean * @description detects mobile device based on current viewport width */ isMobile: function isMobile() { return document.documentElement.offsetWidth <= Configuration.MOBILE_DEVICE_WIDTH; }, /** * * * @returns boolean * @description detects current url protocol */ isSecureProtocol: function isSecureProtocol() { var secureProto = /https/; return secureProto.test(location.protocol); } }; exports.device = device;