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

browser-sync-ui

Package Overview
Dependencies
Maintainers
1
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

browser-sync-ui - npm Package Compare versions

Comparing version 0.2.3 to 0.2.4

77

lib/plugins/connections/connections.js

@@ -9,12 +9,22 @@ var urls = require("../../urls");

var connectedClients = Immutable.Map();
/**
* Use heart-beat information to decorate connected client
* info with things like height/width etc.
* @param registry
* @param connectedClients
* @returns {*}
*/
function decorateClients(registry, connectedClients) {
function decorateClients(connectedClients) {
return connectedClients;
//return connectedClients.map(function (client) {
// return {
// browser: uaParser.setUA(client.handshake.headers["user-agent"]).getBrowser(),
// id: client.id
// }
//});
return registry.map(function (item) {
connectedClients.forEach(function (client) {
if (item.id === client.id) {
item.data = client.data;
return false;
}
});
return item;
});
}

@@ -27,14 +37,5 @@

function sendUpdated(socket, connectedClients) {
//console.log(decorateClients(connectedClients));
socket.emit("cp:connections:update", decorateClients(connectedClients));
socket.emit("cp:connections:update", connectedClients);
}
/**
* @param socketIoClients
* @param connectedClients
*/
function cleanupConnections (connectedClients) {
}
var currentConnections = [];

@@ -65,4 +66,4 @@

if (typeof match === "number") {
console.log("Updating dupe: ", client.id);
currentConnections[match].timestamp = new Date().getTime();
currentConnections[match].data = data;
}

@@ -73,3 +74,4 @@ } else {

timestamp: new Date().getTime(),
browser: uaParser.setUA(client.handshake.headers["user-agent"]).getBrowser()
browser: uaParser.setUA(client.handshake.headers["user-agent"]).getBrowser(),
data: data
});

@@ -95,13 +97,16 @@ }

var recent = getRecentClients(currentConnections, 1000);
if (recent.length) {
temp = Immutable.List(recent);
if (cp.clients.sockets.length) {
temp = Immutable.List(cp.clients.sockets.map(function (client) {
return Immutable.fromJS({
id: client.id,
browser: uaParser.setUA(client.handshake.headers["user-agent"]).getBrowser()
});
}));
if (!registry) {
registry = temp;
sendUpdated(cp.socket, registry.toJS());
sendUpdated(cp.socket, decorateClients(registry.toJS(), currentConnections));
} else {
if (Immutable.is(registry, temp)) {
if (!initialSent) {
sendUpdated(cp.socket, registry.toJS());
sendUpdated(cp.socket, decorateClients(registry.toJS(), currentConnections));
initialSent = true;

@@ -111,9 +116,9 @@ }

registry = temp;
sendUpdated(cp.socket, registry.toJS());
sendUpdated(cp.socket, decorateClients(registry.toJS(), currentConnections));
}
}
} else {
sendUpdated(cp.socket, []);
}
count += 1;
}, 1000);

@@ -172,14 +177,2 @@

/**
* @param immSet
* @param client
* @returns {*}
*/
//function addClient (immSet, client) {
// return immSet.push({
// id: client.id,
// browser: uaParser.setUA(client.handshake.headers["user-agent"]).getBrowser()
// });
//}
function getRecentClients (clients, timeout) {

@@ -186,0 +179,0 @@ var diff = new Date().getTime();

{
"name": "browser-sync-ui",
"description": "User Interface for BrowserSync",
"version": "0.2.3",
"version": "0.2.4",
"homepage": "http://www.browsersync.io/",

@@ -6,0 +6,0 @@ "author": {

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