Commit 4fbb3858 authored by Leo Iannacone's avatar Leo Iannacone

a little refactor for client - more deep refactor needed

parent 6ee9a051
......@@ -45,6 +45,7 @@ var broadcast = new Broadcaster(io.sockets, status)
io.sockets.on('connection', function(socket) {
client = new Client(socket)
client.start()
if (status.packages.length > 0)
client.send_status(status)
});
......
......@@ -142,6 +142,7 @@ function Client (socket) {
var _e = config.events.client
this.start = function () {
// init send distributions and status
utils.get_files_list(config.debomatic.path, true, function(distros) {
socket.emit(config.events.broadcast.distributions, distros);
......@@ -167,12 +168,11 @@ function Client (socket) {
return
__handler_get_file(socket, data)
})
}
return {
send_status: function (status) {
this.send_status = function(status) {
socket.emit(_e.status, status)
}
}
}
module.exports = Client
......@@ -5,3 +5,7 @@ new Page_Generic().init(socket)
if (window.location.pathname == config.paths.distribution) {
new Page_Distrubion(socket).start()
}
socket.on(config.events.client.distribution_packages.status, function(data){
console.log(data)
})
\ No newline at end of file
......@@ -266,7 +266,7 @@ function Page_Distrubion(socket)
update.view()
}
this.start = function (mysocket) {
this.start = function () {
socket.on(events.distribution_packages.set, function(socket_data){
packages.set(socket_data)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment