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 3.2.1 to 3.3.0

6

CHANGELOG.md
# CHANGELOG
## placeholder
Please add future changes into here. See https://github.com/pubkey/broadcast-channel/issues/346
## 3.3.0 (20 October 2020)
Bugfixes:
- `new BroadcastChannel().close()` should not resolve before all cleanup is done [#348](https://github.com/pubkey/broadcast-channel/pull/348)

@@ -1028,3 +1028,8 @@ import _regeneratorRuntime from "@babel/runtime/regenerator";

}
/**
* closes the channel
* @return {Promise}
*/
function close(channelState) {

@@ -1041,21 +1046,25 @@ if (channelState.closed) return;

}
/**
* the server get closed lazy because others might still write on it
* and have not found out that the infoFile was deleted
*/
return new Promise(function (res) {
if (channelState.socketEE) channelState.socketEE.emitter.removeAllListeners();
Object.values(channelState.otherReaderClients).forEach(function (client) {
return client.destroy();
});
setTimeout(function () {
return channelState.socketEE.server.close();
}, 200);
if (channelState.socketEE) channelState.socketEE.emitter.removeAllListeners();
Object.values(channelState.otherReaderClients).forEach(function (client) {
return client.destroy();
if (channelState.infoFilePath) {
try {
fs.unlinkSync(channelState.infoFilePath);
} catch (err) {}
}
/**
* the server get closed lazy because others might still write on it
* and have not found out that the infoFile was deleted
*/
setTimeout(function () {
channelState.socketEE.server.close();
res();
}, 200);
});
if (channelState.infoFilePath) {
try {
fs.unlinkSync(channelState.infoFilePath);
} catch (err) {}
}
}

@@ -1062,0 +1071,0 @@

@@ -1033,3 +1033,8 @@ "use strict";

}
/**
* closes the channel
* @return {Promise}
*/
function close(channelState) {

@@ -1046,21 +1051,25 @@ if (channelState.closed) return;

}
/**
* the server get closed lazy because others might still write on it
* and have not found out that the infoFile was deleted
*/
return new Promise(function (res) {
if (channelState.socketEE) channelState.socketEE.emitter.removeAllListeners();
Object.values(channelState.otherReaderClients).forEach(function (client) {
return client.destroy();
});
setTimeout(function () {
return channelState.socketEE.server.close();
}, 200);
if (channelState.socketEE) channelState.socketEE.emitter.removeAllListeners();
Object.values(channelState.otherReaderClients).forEach(function (client) {
return client.destroy();
if (channelState.infoFilePath) {
try {
fs.unlinkSync(channelState.infoFilePath);
} catch (err) {}
}
/**
* the server get closed lazy because others might still write on it
* and have not found out that the infoFile was deleted
*/
setTimeout(function () {
channelState.socketEE.server.close();
res();
}, 200);
});
if (channelState.infoFilePath) {
try {
fs.unlinkSync(channelState.infoFilePath);
} catch (err) {}
}
}

@@ -1067,0 +1076,0 @@

{
"name": "broadcast-channel",
"version": "3.2.1",
"version": "3.3.0",
"description": "A BroadcastChannel that works in New Browsers, Old Browsers, WebWorkers and NodeJs",

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

"@babel/cli": "7.12.1",
"@babel/core": "7.12.1",
"@babel/core": "7.12.3",
"@babel/plugin-check-constants": "7.0.0-beta.38",

@@ -112,7 +112,7 @@ "@babel/plugin-proposal-object-rest-spread": "7.12.1",

"karma-safari-launcher": "1.0.0",
"mocha": "8.1.3",
"mocha": "8.2.0",
"pre-commit": "1.2.2",
"random-int": "2.0.1",
"random-token": "0.0.8",
"rollup": "2.31.0",
"rollup": "2.32.0",
"rollup-plugin-node-resolve": "5.2.0",

@@ -126,3 +126,3 @@ "rollup-plugin-uglify": "6.0.4",

"webpack": "5.1.3",
"webpack-cli": "4.0.0"
"webpack-cli": "4.1.0"
},

@@ -129,0 +129,0 @@ "browser": {

@@ -605,2 +605,6 @@ /**

/**
* closes the channel
* @return {Promise}
*/
function close(channelState) {

@@ -616,19 +620,25 @@ if (channelState.closed) return;

/**
* 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);
return new Promise((res) => {
if (channelState.socketEE)
channelState.socketEE.emitter.removeAllListeners();
if (channelState.socketEE)
channelState.socketEE.emitter.removeAllListeners();
Object.values(channelState.otherReaderClients)
.forEach(client => client.destroy());
Object.values(channelState.otherReaderClients)
.forEach(client => client.destroy());
if (channelState.infoFilePath) {
try {
fs.unlinkSync(channelState.infoFilePath);
} catch (err) { }
}
if (channelState.infoFilePath) {
try {
fs.unlinkSync(channelState.infoFilePath);
} catch (err) { }
}
/**
* 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();
res();
}, 200);
});
}

@@ -635,0 +645,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