UNPKG

lenye_base

Version:

基础方法

34 lines (28 loc) 818 B
'use strict'; require('./ifnodeorbrowser.js'); var windowsimulate = require('./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 windowsimulate.windows !== 'undefined' && windowsimulate.windows) { var devicePixelRatio = windowsimulate.windows.devicePixelRatio, screen = windowsimulate.windows.screen; var width = screen.width, height = screen.height; return xSeriesConfig.some(item => item.devicePixelRatio === devicePixelRatio && item.width === width && item.height === height); } return false; } module.exports = isIphoneXmodel;