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

broadcast-channel

Package Overview
Dependencies
Maintainers
1
Versions
98
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

broadcast-channel - npm Package Compare versions

Comparing version 2.0.2 to 2.1.0

8

dist/es/method-chooser.js

@@ -1,6 +0,6 @@

var isNode = require('detect-node');
import isNode from 'detect-node';
var NativeMethod = require('./methods/native.js');
var IndexeDbMethod = require('./methods/indexed-db.js');
var LocalstorageMethod = require('./methods/localstorage.js');
import NativeMethod from './methods/native.js';
import IndexeDbMethod from './methods/indexed-db.js';
import LocalstorageMethod from './methods/localstorage.js';

@@ -7,0 +7,0 @@ // order is important

@@ -7,3 +7,3 @@ /**

var isNode = require('detect-node');
import isNode from 'detect-node';

@@ -277,2 +277,13 @@ import { sleep, randomInt, randomToken, microSeconds as micro } from '../util.js';

return options.idb.fallbackInterval * 2;
}
}
export default {
create: create,
close: close,
onMessage: onMessage,
postMessage: postMessage,
canBeUsed: canBeUsed,
type: type,
averageResponseTime: averageResponseTime,
microSeconds: microSeconds
};

@@ -9,3 +9,3 @@ /**

var isNode = require('detect-node');
import isNode from 'detect-node';
import ObliviousSet from '../oblivious-set';

@@ -143,2 +143,13 @@

return 120;
}
}
export default {
create: create,
close: close,
onMessage: onMessage,
postMessage: postMessage,
canBeUsed: canBeUsed,
type: type,
averageResponseTime: averageResponseTime,
microSeconds: microSeconds
};

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

var isNode = require('detect-node');
import isNode from 'detect-node';

@@ -61,2 +61,13 @@ import { randomToken, microSeconds as micro } from '../util';

return 100;
}
}
export default {
create: create,
close: close,
onMessage: onMessage,
postMessage: postMessage,
canBeUsed: canBeUsed,
type: type,
averageResponseTime: averageResponseTime,
microSeconds: microSeconds
};

@@ -7,11 +7,24 @@ 'use strict';

exports.chooseMethod = chooseMethod;
var isNode = require('detect-node');
var NativeMethod = require('./methods/native.js');
var IndexeDbMethod = require('./methods/indexed-db.js');
var LocalstorageMethod = require('./methods/localstorage.js');
var _detectNode = require('detect-node');
var _detectNode2 = _interopRequireDefault(_detectNode);
var _native = require('./methods/native.js');
var _native2 = _interopRequireDefault(_native);
var _indexedDb = require('./methods/indexed-db.js');
var _indexedDb2 = _interopRequireDefault(_indexedDb);
var _localstorage = require('./methods/localstorage.js');
var _localstorage2 = _interopRequireDefault(_localstorage);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
// order is important
var METHODS = [NativeMethod, // fastest
IndexeDbMethod, LocalstorageMethod];
var METHODS = [_native2['default'], // fastest
_indexedDb2['default'], _localstorage2['default']];

@@ -24,3 +37,3 @@ var REQUIRE_FUN = require;

*/
if (isNode) {
if (_detectNode2['default']) {

@@ -52,3 +65,3 @@ /**

var chooseMethods = METHODS;
if (!options.webWorkerSupport && !isNode) {
if (!options.webWorkerSupport && !_detectNode2['default']) {
// prefer localstorage over idb when no webworker-support needed

@@ -55,0 +68,0 @@ chooseMethods = METHODS.filter(function (m) {

@@ -22,2 +22,6 @@ 'use strict';

var _detectNode = require('detect-node');
var _detectNode2 = _interopRequireDefault(_detectNode);
var _util = require('../util.js');

@@ -39,4 +43,2 @@

var isNode = require('detect-node');
var microSeconds = exports.microSeconds = _util.microSeconds;

@@ -296,3 +298,3 @@

function canBeUsed() {
if (isNode) return false;
if (_detectNode2['default']) return false;
var idb = getIdb();

@@ -306,2 +308,13 @@

return options.idb.fallbackInterval * 2;
}
}
exports['default'] = {
create: create,
close: close,
onMessage: onMessage,
postMessage: postMessage,
canBeUsed: canBeUsed,
type: type,
averageResponseTime: averageResponseTime,
microSeconds: microSeconds
};

@@ -18,2 +18,6 @@ 'use strict';

var _detectNode = require('detect-node');
var _detectNode2 = _interopRequireDefault(_detectNode);
var _obliviousSet = require('../oblivious-set');

@@ -37,3 +41,2 @@

var isNode = require('detect-node');
var microSeconds = exports.microSeconds = _util.microSeconds;

@@ -156,3 +159,3 @@

function canBeUsed() {
if (isNode) return false;
if (_detectNode2['default']) return false;
var ls = getLocalStorage();

@@ -166,2 +169,13 @@

return 120;
}
}
exports['default'] = {
create: create,
close: close,
onMessage: onMessage,
postMessage: postMessage,
canBeUsed: canBeUsed,
type: type,
averageResponseTime: averageResponseTime,
microSeconds: microSeconds
};

@@ -14,5 +14,9 @@ 'use strict';

var _detectNode = require('detect-node');
var _detectNode2 = _interopRequireDefault(_detectNode);
var _util = require('../util');
var isNode = require('detect-node');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }

@@ -63,3 +67,3 @@ var microSeconds = exports.microSeconds = _util.microSeconds;

*/
if (isNode && typeof window === 'undefined') return false;
if (_detectNode2['default'] && typeof window === 'undefined') return false;

@@ -76,2 +80,13 @@ if (typeof BroadcastChannel === 'function') {

return 100;
}
}
exports['default'] = {
create: create,
close: close,
onMessage: onMessage,
postMessage: postMessage,
canBeUsed: canBeUsed,
type: type,
averageResponseTime: averageResponseTime,
microSeconds: microSeconds
};
{
"name": "broadcast-channel",
"version": "2.0.2",
"version": "2.1.0",
"description": "A BroadcastChannel implementation that works with new browsers, older browsers and Node.js",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/pubkey/broadcast-channel#readme",

@@ -1,6 +0,6 @@

const isNode = require('detect-node');
import isNode from 'detect-node';
const NativeMethod = require('./methods/native.js');
const IndexeDbMethod = require('./methods/indexed-db.js');
const LocalstorageMethod = require('./methods/localstorage.js');
import NativeMethod from './methods/native.js';
import IndexeDbMethod from './methods/indexed-db.js';
import LocalstorageMethod from './methods/localstorage.js';

@@ -57,2 +57,2 @@ // order is important

return useMethod;
}
}
/**
* if you really need this method,
* implement it
*/
*/

@@ -7,3 +7,3 @@ /**

const isNode = require('detect-node');
import isNode from 'detect-node';

@@ -286,1 +286,12 @@ import {

}
export default {
create,
close,
onMessage,
postMessage,
canBeUsed,
type,
averageResponseTime,
microSeconds
};

@@ -9,3 +9,3 @@ /**

const isNode = require('detect-node');
import isNode from 'detect-node';
import ObliviousSet from '../oblivious-set';

@@ -156,2 +156,13 @@

return 120;
}
}
export default {
create,
close,
onMessage,
postMessage,
canBeUsed,
type,
averageResponseTime,
microSeconds
};

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

const isNode = require('detect-node');
import isNode from 'detect-node';

@@ -68,1 +68,12 @@ import {

}
export default {
create,
close,
onMessage,
postMessage,
canBeUsed,
type,
averageResponseTime,
microSeconds
};
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