UNPKG

@upendradevsingh/webcore

Version:
37 lines (33 loc) 873 B
/** * ======================================================= * 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) */ const Configuration = { MOBILE_DEVICE_WIDTH: 767 }; const device = { /** * * * @returns boolean * @description detects mobile device based on current viewport width */ isMobile(){ return document.documentElement.offsetWidth <= Configuration.MOBILE_DEVICE_WIDTH; }, /** * * * @returns boolean * @description detects current url protocol */ isSecureProtocol(){ const secureProto = /https/ return secureProto.test(location.protocol); } } export { device };