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 1.2.2 to 1.2.3

43

dist/es/methods/node.js

@@ -874,3 +874,6 @@ import _regeneratorRuntime from 'babel-runtime/regenerator';

_context18.next = 8;
return Promise.all(Object.values(channelState.otherReaderClients).map(function (client) {
return Promise.all(Object.values(channelState.otherReaderClients).filter(function (client) {
return client.writable;
}) // client might have closed in between
.map(function (client) {
return client.write(JSON.stringify(pingObj));

@@ -932,2 +935,10 @@ }));

case 0:
if (!channelState.closed) {
_context20.next = 2;
break;
}
return _context20.abrupt('return');
case 2:
channelState.closed = true;

@@ -937,3 +948,10 @@

channelState.socketEE.server.close();
/**
* the server get closed lazy because others might still write on it
* and have not found out that the infoFile was deleted
*/
setTimeout(function () {
return channelState.socketEE.server.close();
}, 200);
channelState.socketEE.emitter.removeAllListeners();

@@ -943,16 +961,9 @@ channelState.readQueue.clear();

_context20.prev = 6;
_context20.next = 9;
return unlink(channelState.infoFilePath);
_context20.next = 10;
return unlink(channelState.infoFilePath)['catch'](function () {
return null;
});
case 9:
_context20.next = 13;
break;
case 10:
case 11:
_context20.prev = 11;
_context20.t0 = _context20['catch'](6);
case 13:
Object.values(channelState.otherReaderClients).forEach(function (client) {

@@ -962,3 +973,3 @@ return client.destroy();

case 14:
case 11:
case 'end':

@@ -968,3 +979,3 @@ return _context20.stop();

}
}, _callee19, this, [[6, 11]]);
}, _callee19, this);
}));

@@ -971,0 +982,0 @@

@@ -819,3 +819,6 @@ 'use strict';

_context18.next = 8;
return Promise.all(Object.values(channelState.otherReaderClients).map(function (client) {
return Promise.all(Object.values(channelState.otherReaderClients).filter(function (client) {
return client.writable;
}) // client might have closed in between
.map(function (client) {
return client.write(JSON.stringify(pingObj));

@@ -869,2 +872,10 @@ }));

case 0:
if (!channelState.closed) {
_context20.next = 2;
break;
}
return _context20.abrupt('return');
case 2:
channelState.closed = true;

@@ -874,3 +885,10 @@

channelState.socketEE.server.close();
/**
* the server get closed lazy because others might still write on it
* and have not found out that the infoFile was deleted
*/
setTimeout(function () {
return channelState.socketEE.server.close();
}, 200);
channelState.socketEE.emitter.removeAllListeners();

@@ -880,16 +898,9 @@ channelState.readQueue.clear();

_context20.prev = 6;
_context20.next = 9;
return unlink(channelState.infoFilePath);
_context20.next = 10;
return unlink(channelState.infoFilePath)['catch'](function () {
return null;
});
case 9:
_context20.next = 13;
break;
case 10:
case 11:
_context20.prev = 11;
_context20.t0 = _context20['catch'](6);
case 13:
Object.values(channelState.otherReaderClients).forEach(function (client) {

@@ -899,3 +910,3 @@ return client.destroy();

case 14:
case 11:
case 'end':

@@ -905,3 +916,3 @@ return _context20.stop();

}
}, _callee19, this, [[6, 11]]);
}, _callee19, this);
}));

@@ -908,0 +919,0 @@

{
"name": "broadcast-channel",
"version": "1.2.2",
"version": "1.2.3",
"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",

@@ -451,2 +451,3 @@ /**

Object.values(channelState.otherReaderClients)
.filter(client => client.writable) // client might have closed in between
.map(client => client.write(JSON.stringify(pingObj)))

@@ -479,2 +480,3 @@ );

export async function close(channelState) {
if (channelState.closed) return;
channelState.closed = true;

@@ -485,3 +487,8 @@

channelState.socketEE.server.close();
/**
* the server get closed lazy because others might still write on it
* and have not found out that the infoFile was deleted
*/
setTimeout(() => channelState.socketEE.server.close(), 200);
channelState.socketEE.emitter.removeAllListeners();

@@ -491,5 +498,3 @@ channelState.readQueue.clear();

try {
await unlink(channelState.infoFilePath);
} catch (err) { }
await unlink(channelState.infoFilePath).catch(() => null);

@@ -496,0 +501,0 @@ Object.values(channelState.otherReaderClients)

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