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

no-internet

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

no-internet - npm Package Compare versions

Comparing version 1.2.1 to 1.3.0

2

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

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