bbo
Version:
bbo is a utility library of zero dependencies for javascript.
32 lines (27 loc) • 695 B
JavaScript
;
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 window !== 'undefined' && window) {
var _window = window,
devicePixelRatio = _window.devicePixelRatio,
screen = _window.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;