Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-offline

Package Overview
Dependencies
Maintainers
1
Versions
60
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-offline - npm Package Compare versions

Comparing version 3.4.1 to 3.5.0

src/makeHttpRequest.js

2

package.json
{
"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 @@ });

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc