UNPKG

lenye_base

Version:

基础方法

32 lines (27 loc) 733 B
import './ifnodeorbrowser.js'; import { windows } from './windowsimulate.js'; function isIphoneXmodel() { // X XS, XS Max, XR var xSeriesConfig = [{ devicePixelRatio: 3, width: 375, height: 812 }, { devicePixelRatio: 3, width: 414, height: 896 }, { devicePixelRatio: 2, width: 414, height: 896 }]; if (typeof windows !== 'undefined' && windows) { var devicePixelRatio = windows.devicePixelRatio, screen = windows.screen; var width = screen.width, height = screen.height; return xSeriesConfig.some(item => item.devicePixelRatio === devicePixelRatio && item.width === width && item.height === height); } return false; } export default isIphoneXmodel;