UNPKG

@cake-fxd/cake-cli-presets

Version:

蛋糕英语前端模版项目集合

28 lines (23 loc) 669 B
import { getQuery } from './url' const ua: string = window.navigator.userAgent const isDev: boolean = process.env.NODE_ENV !== 'production' export const UA: UAType = { isDev, isDebug: !!getQuery('__debug'), isAndroid: !!/linux|android/.test(ua), isSafari: !!/safari/.test(ua) && !/chrome/.test(ua), isIos: !!ua.match(/\(i[^;]+;( u;)? cpu.+mac os x/), isWeiXin: !!/micromessenger/.test(ua), isMobile: !!/mobile/.test(ua), isWeiXinDebug: !!getQuery('__wxDebug') } export interface UAType { isDev: boolean isDebug: boolean isAndroid: boolean isSafari: boolean isIos: boolean isWeiXin: boolean isMobile: boolean isWeiXinDebug: boolean }