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

connection-state

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connection-state - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

34

dist/index.es.js

@@ -1,34 +0,2 @@

var listenable = function () {
var listeners = [];
var findIndex = function (callback) {
return listeners.findIndex(function (listener) { return listener.callback === callback; });
};
var addListener = function (callback, options) {
if (options === void 0) { options = {}; }
// Prevent duplicate listeners
if (findIndex(callback) >= 0) {
return;
}
listeners.push({ callback: callback, options: options });
};
var removeListener = function (callback) {
var listenerIndex = findIndex(callback);
if (listenerIndex >= 0) {
listeners.splice(listenerIndex, 1);
}
};
var emit = function (data) {
listeners.forEach(function (listener) {
listener.callback(data);
if (listener.options.once) {
removeListener(listener.callback);
}
});
};
return {
addListener: addListener,
removeListener: removeListener,
emit: emit,
};
};
import { listenable } from 'custom-listenable';

@@ -35,0 +3,0 @@ var connectionState = function (options) {

'use strict';
var listenable = function () {
var listeners = [];
var findIndex = function (callback) {
return listeners.findIndex(function (listener) { return listener.callback === callback; });
};
var addListener = function (callback, options) {
if (options === void 0) { options = {}; }
// Prevent duplicate listeners
if (findIndex(callback) >= 0) {
return;
}
listeners.push({ callback: callback, options: options });
};
var removeListener = function (callback) {
var listenerIndex = findIndex(callback);
if (listenerIndex >= 0) {
listeners.splice(listenerIndex, 1);
}
};
var emit = function (data) {
listeners.forEach(function (listener) {
listener.callback(data);
if (listener.options.once) {
removeListener(listener.callback);
}
});
};
return {
addListener: addListener,
removeListener: removeListener,
emit: emit,
};
};
var customListenable = require('custom-listenable');
var connectionState = function (options) {
if (options === void 0) { options = {}; }
var listener = listenable();
var listener = customListenable.listenable();
var _a = options.endpoints, endpoints = _a === void 0 ? [] : _a;

@@ -41,0 +9,0 @@ if (endpoints.length > 0) {

2

package.json
{
"name": "connection-state",
"version": "0.0.3",
"version": "0.0.4",
"description": "Detect online and offline network state.",

@@ -5,0 +5,0 @@ "main": "./dist/index.js",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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