UNPKG

@shencom/utils-platform

Version:
45 lines (41 loc) 1.05 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); let isIOS = () => { const flag = !!navigator.userAgent.match(/ipad|iphone/i); if (flag) { isIOS = () => true; } else { isIOS = () => false; } return flag; }; const IsIOS = () => isIOS(); let isAndroid = () => { const u = navigator.userAgent; const isAndroidphone = u.includes("Android") || u.includes("Linux"); if (isAndroidphone) { isAndroid = () => true; } else { isAndroid = () => false; } return isAndroidphone; }; const IsAndroid = () => isAndroid(); let isPC = () => { const userAgentInfo = navigator.userAgent; const Agents = ["Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod"]; let flag = true; for (let v = 0; v < Agents.length; v++) { if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; } } isPC = () => flag; return flag; }; const IsPC = () => isPC(); exports.IsAndroid = IsAndroid; exports.IsIOS = IsIOS; exports.IsPC = IsPC; //# sourceMappingURL=index.cjs.map