Permalink
Browse files

Cleaned up code a little bit

  • Loading branch information...
1 parent 5f47060 commit f030adbde93c34f31d767c31c8887dee1b14c256 @danielkutik danielkutik committed Mar 6, 2013
Showing with 5 additions and 8 deletions.
  1. +5 −8 lib/webrtc.io.js
View
@@ -7,8 +7,8 @@ for (var i = 0; i < process.argv.length; i++) {
var arg = process.argv[i];
if (arg === "-debug") {
iolog = function(msg) {
- console.log(msg)
- }
+ console.log(msg);
+ };
console.log('Debug mode on!');
}
}
@@ -85,9 +85,10 @@ function attachEvents(manager) {
rtc.sockets.splice(i, 1);
// remove from rooms and send remove_peer_connected to all sockets in room
+ var room;
for (var key in rtc.rooms) {
- var room = rtc.rooms[key];
+ room = rtc.rooms[key];
var exist = room.indexOf(socket.id);
if (exist !== -1) {
@@ -242,15 +243,11 @@ function attachEvents(manager) {
}
// generate a 4 digit hex code randomly
-
-
function S4() {
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
}
// make a REALLY COMPLICATED AND RANDOM id, kudos to dennis
-
-
function id() {
return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4());
}
@@ -268,4 +265,4 @@ rtc.getSocket = function(id) {
return socket;
}
}
-}
+};

0 comments on commit f030adb

Please sign in to comment.