Skip to content

Instantly share code, notes, and snippets.

View pradhul-dev's full-sized avatar

pradhul Dev pradhul-dev

  • HashedIn
  • Bangalore
View GitHub Profile
@pradhul-dev
pradhul-dev / connectivityManager.js
Last active November 5, 2019 10:18
React native's Netinfo gives connectivity status but not actually tells weather any URL is reachable or not
import { TimeoutError } from 'rxjs'
import { ajax } from 'rxjs/ajax'
import { catchError, map, timeout } from 'rxjs/operators'
/**
* Netinfo method for checking internet connection won't tell weather the internet is actually accessible or not
* make a test API call to verify
*/
export function isInternetAvailable() {
ajax('https://google.com').pipe(
timeout(100),