browser-sync-ui
Advanced tools
Comparing version
@@ -148,2 +148,5 @@ var Immutable = require("immutable"); | ||
var bs = ui.bs; | ||
ui.clients.on("connection", function (client) { | ||
client.emit("cp:connection", {name:"shnae"}); | ||
}); | ||
ui.socket.on("connection", function (client) { | ||
@@ -150,0 +153,0 @@ client.emit("connection", bs.getOptions().toJS()); |
@@ -7,3 +7,3 @@ "use strict"; | ||
socket.on("connection", function (options) { | ||
socket.on("cp:connection", function (options) { | ||
@@ -10,0 +10,0 @@ bs.socket.emit("urls:client:connected", { |
@@ -10,14 +10,11 @@ var urls = require("../../urls"); | ||
/** | ||
* Use heart-beat information to decorate connected client | ||
* info with things like height/width etc. | ||
* @param registry | ||
* @param connectedClients | ||
* Use heart-beated data to decorate clients | ||
* @param clients | ||
* @param clientsInfo | ||
* @returns {*} | ||
*/ | ||
function decorateClients(registry, connectedClients) { | ||
return registry.map(function (item) { | ||
connectedClients.forEach(function (client) { | ||
if (item.id === client.id) { | ||
function decorateClients(clients, clientsInfo) { | ||
return clients.map(function (item) { | ||
clientsInfo.forEach(function (client) { | ||
if (client.id === item.id) { | ||
item.data = client.data; | ||
@@ -27,3 +24,2 @@ return false; | ||
}); | ||
return item; | ||
@@ -41,4 +37,2 @@ }); | ||
var currentConnections = []; | ||
/** | ||
@@ -55,2 +49,3 @@ * @type {{plugin: Function, plugin:name: string, markup: string}} | ||
var uaParser = new bs.utils.UAParser(); | ||
var currentConnections = []; | ||
@@ -79,3 +74,2 @@ cp.clients.on("connection", function (client) { | ||
} | ||
// todo add window size stuff | ||
}); | ||
@@ -174,20 +168,2 @@ }); | ||
return match; | ||
} | ||
function getRecentClients (clients, timeout) { | ||
var diff = new Date().getTime(); | ||
return clients.filter(function (client) { | ||
if ((diff - client.timestamp) < timeout) { | ||
return true; | ||
} | ||
}); | ||
} | ||
function getClientList (sockets, uaParser) { | ||
return sockets.map(function (client) { | ||
return Immutable.fromJS({ | ||
id: client.id, | ||
browser: uaParser.setUA(client.handshake.headers["user-agent"]).getBrowser() | ||
}); | ||
}); | ||
} |
{ | ||
"name": "browser-sync-ui", | ||
"description": "User Interface for BrowserSync", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"homepage": "http://www.browsersync.io/", | ||
@@ -53,3 +53,3 @@ "author": { | ||
"async": "^0.9.0", | ||
"browser-sync": "git://github.com/shakyshane/browser-sync#v2-rc3.4", | ||
"browser-sync": "git://github.com/shakyshane/browser-sync", | ||
"bs-html-injector": "^1.2.1", | ||
@@ -80,2 +80,3 @@ "chai": "^1.9.1", | ||
"pretty-js": "^0.1.8", | ||
"request": "^2.51.0", | ||
"sinon": "^1.10.3", | ||
@@ -82,0 +83,0 @@ "supertest": "^0.14.0" |
@@ -1,13 +0,7 @@ | ||
# browser-sync-ui [](https://travis-ci.org/shakyShane/browser-sync-ui) | ||
# BrowserSync UI [](https://travis-ci.org/BrowserSync/UI) | ||
User Interface for BrowserSync | ||
Comes bundled with the BrowserSync module (version `2.0.0` onwards). | ||
## Contributors | ||
``` | ||
246 Shane Osbourne | ||
``` | ||
## License | ||
Copyright (c) 2014 Shane Osbourne | ||
Licensed under the MIT license. | ||
Copyright (c) 2015 Shane Osbourne | ||
Licensed under the Apache 2.0 license. |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
3453287
-3.55%31
3.33%137
-1.44%5411
-0.18%8
-42.86%