detected-device
v1.1.2
Published
Get the device type, based on window.innerWidth and window.innerHeight
Downloads
17
Maintainers
Readme
Installation
npm i detected-device
Usage
import {detectedDevice} from 'detected-device'
let isMobile = detectedDevice.isMobile()
if(isMobile){
//code for portrait or landscape smartphone here...
if(isMobile === 'portrait'){
//code for portrait smartphone here...
}
else if(isMobile === 'landscape'){
//code for landscape smartphone here...
}
}
else{
//is not mobile device
}
Instance options
| Option | Value | Description |
| ------------------------------------- | ---------- | ----------------- |
| detectedDevice.isMobile()
| portrait
,landscape
,false
|
| detectedDevice.isSmallTablet()
| portrait
,landscape
,false
|
| detectedDevice.isBigTablet()
| portrait
,landscape
,false
|
| detectedDevice.isAllTablet()
| true
,false
| isSmallTablet() || isBigTablet()
| detectedDevice.isAllMobileDevices()
| true
,false
| isMobile() || isAllTablet()