no-internet
Advanced tools
Comparing version 1.2.1 to 1.3.0
{ | ||
"name": "no-internet", | ||
"version": "1.2.1", | ||
"version": "1.3.0", | ||
"description": "Checking if the internet is accessible (not local connection only)", | ||
@@ -5,0 +5,0 @@ "main": "./src/no-internet.js", |
@@ -17,6 +17,5 @@ /* | ||
const OFFLINE = true; | ||
const ONLINE = false; | ||
const defaultOptions = { | ||
var OFFLINE = true; | ||
var ONLINE = false; | ||
var defaultOptions = { | ||
milliseconds: 5000, | ||
@@ -36,3 +35,3 @@ url: '/favicon.ico' | ||
if (!(!!options.callback)) { | ||
return new Promise(resolve => { | ||
return new Promise(function (resolve) { | ||
_checkConnection(options.url, resolve); | ||
@@ -71,7 +70,7 @@ }); | ||
function _initEventListeners(callback) { | ||
window.addEventListener('online', () => { | ||
window.addEventListener('online', function () { | ||
callback(ONLINE); | ||
}); | ||
window.addEventListener('offline', () => { | ||
window.addEventListener('offline', function () { | ||
callback(OFFLINE); | ||
@@ -87,9 +86,9 @@ }); | ||
function _sendRequest(url, callback) { | ||
let xhr = new XMLHttpRequest(); | ||
var xhr = new XMLHttpRequest(); | ||
xhr.onload = () => { | ||
xhr.onload = function () { | ||
callback(ONLINE); | ||
}; | ||
xhr.onerror = () => { | ||
xhr.onerror = function () { | ||
callback(OFFLINE); | ||
@@ -96,0 +95,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
9448