1.0.5 • Published 6 years ago
online-status-checker v1.0.5
online-status-checker
A node module with a few methods to easily check if you're online or a certain website is reachable.
Install
npm i online-status-checker --save
Simple Usage Examples:
Import the Module:
import { checkNetworkConnection, checkServerIsReachable, checkInternetConnection } from 'online-status-checker';
Check if there is a network connection - returns true or false
const result = checkNetworkConnection();
console.log(result);
Check if a specific url is alive / reachable (Status: 200) or not - returns true or false
const url = 'http://someurl.com';
const result2 = checkServerIsReachable(url);
console.log(result2);
Check if browser is online - returns true or false
const result3 = checkInternetConnection();
console.log(result3);
Angular Example:
import { Component } from '@angular/core';
import { checkNetworkConnection, checkServerIsReachable, checkInternetConnection } from 'online-status-checker';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
url = 'http://someurl.com';
result1;
result2;
result3;
constructor() {
this.result1 = checkNetworkConnection();
this.result2 = checkServerIsReachable(url);
this.result3 = checkInternetConnection();
}
}
Author
Steven Fernandez
License
This project is licensed under the MIT License - see the LICENSE.md file for details
Changelog
1.0.0 - 2018-09-16
Added
- First Commit
1.0.1 - 2018-09-16
Added Readme
- Added readme with example usage
1.0.2 - 2018-09-16
Added Readme
- Added example for Angular 6
1.0.3 - 2018-09-16
Added Readme
- Readme Tidy
1.0.4 - 2018-09-16
Added Readme
- Readme Tidy
1.0.5 - 2018-09-16
Updated Readme
- Code Updates