react-device-detect
Advanced tools
Comparing version 1.12.1 to 1.13.1
@@ -59,2 +59,6 @@ | ||
export import isElectron = ReactDeviceDetect.isElectron; | ||
export import isEdgeChromium = ReactDeviceDetect.isEdgeChromium; | ||
export import isLegacyEdge = ReactDeviceDetect.isLegacyEdge; | ||
export import isWindows = ReactDeviceDetect.isWindows; | ||
export import isMacOs = ReactDeviceDetect.isMacOs; | ||
export import withOrientationChange = ReactDeviceDetect.withOrientationChange; | ||
@@ -188,2 +192,10 @@ } | ||
export const isElectron: boolean; | ||
export const isEdgeChromium: boolean; | ||
export const isLegacyEdge: boolean; | ||
export const isWindows: boolean; | ||
export const isMacOs: boolean; | ||
} |
35
main.js
@@ -35,3 +35,3 @@ 'use strict'; | ||
var nav = getNavigatorInstance(); | ||
return nav && (nav.platform.indexOf(type) !== -1 || nav.platform === 'MacIntel' && nav.maxTouchPoints > 1 && !window.MSStream); | ||
return nav && nav.platform && (nav.platform.indexOf(type) !== -1 || nav.platform === 'MacIntel' && nav.maxTouchPoints > 1 && !window.MSStream); | ||
}; | ||
@@ -207,3 +207,4 @@ | ||
IE: 'IE', | ||
MOBILE_SAFARI: "Mobile Safari" | ||
MOBILE_SAFARI: "Mobile Safari", | ||
EDGE_CHROMIUM: "Edge Chromium" | ||
}; | ||
@@ -213,3 +214,5 @@ var OS_TYPES = { | ||
ANDROID: "Android", | ||
WINDOWS_PHONE: "Windows Phone" | ||
WINDOWS_PHONE: "Windows Phone", | ||
WINDOWS: 'Windows', | ||
MAC_OS: 'Mac OS' | ||
}; | ||
@@ -367,2 +370,10 @@ var initialData = { | ||
var isEdgeChromiumType = function isEdgeChromiumType() { | ||
if (os.name === OS_TYPES.WINDOWS && os.version === '10') { | ||
return typeof ua === 'string' && ua.indexOf('Edg/') !== -1; | ||
} | ||
return false; | ||
}; | ||
var isSmartTVType = function isSmartTVType() { | ||
@@ -388,2 +399,10 @@ return device.type === DEVICE_TYPES.SMART_TV; | ||
var isWindowsType = function isWindowsType() { | ||
return os.name === OS_TYPES.WINDOWS; | ||
}; | ||
var isMacOsType = function isMacOsType() { | ||
return os.name === OS_TYPES.MAC_OS; | ||
}; | ||
var isWinPhoneType = function isWinPhoneType() { | ||
@@ -527,3 +546,3 @@ return os.name === OS_TYPES.WINDOWS_PHONE; | ||
var getUA = getUseragent(); | ||
var isEdge = isEdgeType(); | ||
var isEdge = isEdgeType() || isEdgeChromiumType(); | ||
var isYandex = isYandexType(); | ||
@@ -536,2 +555,6 @@ var deviceType = getDeviceType(); | ||
var isElectron = isElectronType(); | ||
var isEdgeChromium = isEdgeChromiumType(); | ||
var isLegacyEdge = isEdgeType(); | ||
var isWindows = isWindowsType(); | ||
var isMacOs = isMacOsType(); | ||
@@ -766,2 +789,3 @@ var AndroidView = function AndroidView(_ref) { | ||
exports.isEdge = isEdge; | ||
exports.isEdgeChromium = isEdgeChromium; | ||
exports.isElectron = isElectron; | ||
@@ -775,2 +799,4 @@ exports.isFirefox = isFirefox; | ||
exports.isIPod13 = isIPod13; | ||
exports.isLegacyEdge = isLegacyEdge; | ||
exports.isMacOs = isMacOs; | ||
exports.isMobile = isMobile; | ||
@@ -785,2 +811,3 @@ exports.isMobileOnly = isMobileOnly; | ||
exports.isWinPhone = isWinPhone; | ||
exports.isWindows = isWindows; | ||
exports.isYandex = isYandex; | ||
@@ -787,0 +814,0 @@ exports.mobileModel = mobileModel; |
{ | ||
"name": "react-device-detect", | ||
"version": "1.12.1", | ||
"version": "1.13.1", | ||
"description": "Detect device type and render your component according to it", | ||
@@ -5,0 +5,0 @@ "main": "main.js", |
@@ -130,3 +130,3 @@ ## react-device-detect | ||
| isIE | bool | returns true if browser is `Internet Explorer` | | ||
| isEdge | bool | returns true if browser is `Edge` | | ||
| isEdge | bool | returns true if browser is `Edge` or `Edge Chromium` | | ||
| isYandex | bool | returns true if browser is `Yandex` | | ||
@@ -150,5 +150,8 @@ | isChromium | bool | returns true if browser is `Chromium` | | ||
| isIPod13 | boolean | returns true/false if device is iPod and running on iOS13 | | ||
| isElectron | boolean | returns true/false if running on Electron | | ||
| deviceDetect | function | return data object which includes all data about device (e.g version, engine, os etc.) | | ||
| isElectron | boolean | returns true/false if running on `Electron` | | ||
| isEdgeChromium | boolean | returns true/false if browser is `Edge Chromium` | | ||
| isLegacyEdge | boolean | returns true if browser is `Edge` | | ||
| isWindows | boolean | returns true/false if os is `Windows` | | ||
| isMacOs | boolean | returns true/false if os is `Mac OS` | | ||
| deviceDetect | boolean | return data object which includes all data about device (e.g version, engine, os etc.) | | ||
### Views | ||
@@ -201,4 +204,15 @@ | ||
### Testing | ||
```js | ||
import * as rdd from 'react-device-detect'; | ||
rdd.isMobile = true; | ||
// use in tests | ||
``` | ||
## License | ||
MIT |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
48278
870
216