react-native-offline
Advanced tools
Comparing version 3.4.1 to 3.5.0
{ | ||
"name": "react-native-offline", | ||
"version": "3.4.1", | ||
"version": "3.5.0", | ||
"description": "Handy toolbelt to deal with offline mode in React Native applications. Cross-platform, provides a smooth redux integration.", | ||
@@ -5,0 +5,0 @@ "main": "./src/index.js", |
/* @flow */ | ||
import makeHttpRequest from './makeHttpRequest'; | ||
export default function checkInternetAccess( | ||
timeout: number = 3000, | ||
address: string = 'https://google.com', | ||
url: string = 'https://google.com', | ||
): Promise<boolean> { | ||
return new Promise((resolve: (value: boolean) => void) => { | ||
const tm = setTimeout(() => { | ||
resolve(false); | ||
}, timeout); | ||
fetch(address, { method: 'HEAD' }) | ||
makeHttpRequest({ | ||
method: 'HEAD', | ||
url, | ||
timeout, | ||
}) | ||
.then(() => { | ||
clearTimeout(tm); | ||
resolve(true); | ||
}) | ||
.catch(() => { | ||
clearTimeout(tm); | ||
resolve(false); | ||
@@ -20,0 +19,0 @@ }); |
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
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
62182
17
1207
0