Permalink
Browse files

Switch tabs to " ". Lint.

Signed-off-by: Connorhd <connorhd@gmail.com>
  • Loading branch information...
1 parent 7583697 commit 1f640d15f027970f0893200225469bfacd6a0f34 @ry ry committed with Sep 8, 2009
Showing with 243 additions and 243 deletions.
  1. +117 −117 debug.js
  2. +1 −1 example.js
  3. +118 −118 index.html
  4. +7 −7 screen.css
View
@@ -3,7 +3,7 @@ var fu = require("fu.js");
var debug = exports;
debug.listen = function(port, host) {
- fu.listen(port, host);
+ fu.listen(port, host);
};
fu.get("/", fu.staticHandler("index.html"));
@@ -17,74 +17,74 @@ fu.get("/treeview-default.gif", fu.staticHandler("treeview-default.gif"));
fu.get("/treeview-default-line.gif", fu.staticHandler("treeview-default-line.gif"));
fu.get("/eval", function (req, res) {
- if (req.uri.params.eval !== undefined) {
- res.simpleJSON(200, evalStr(req.uri.params.eval));
- } else {
- res.simpleText(200, 'Error');
- }
+ if (req.uri.params.eval !== undefined) {
+ res.simpleJSON(200, evalStr(req.uri.params.eval));
+ } else {
+ res.simpleText(200, 'Error');
+ }
});
fu.get("/tree", function (req, res) {
- if (req.uri.params.root !== undefined && req.uri.params.root !== 'source') {
- res.simpleJSON(200, getObj(req.uri.params.root));
- } else {
- res.simpleJSON(200, getObj('process'));
- }
+ if (req.uri.params.root !== undefined && req.uri.params.root !== 'source') {
+ res.simpleJSON(200, getObj(req.uri.params.root));
+ } else {
+ res.simpleJSON(200, getObj('process'));
+ }
});
fu.get("/console", function (req, res) {
- if (req.uri.params.id !== undefined) {
- handleConsole(req.uri.params.id, res);
- } else {
- res.simpleText(200, 'Error');
- }
+ if (req.uri.params.id !== undefined) {
+ handleConsole(req.uri.params.id, res);
+ } else {
+ res.simpleText(200, 'Error');
+ }
});
var SESSION_TIMEOUT = 60 * 1000;
var sessions = [];
-function handleConsole(id, res) {
- if (sessions[id] === undefined) {
- // Create session
- sessions[id] = {
- timestamp: 0,
- queue: []
- };
- }
-
- var session = sessions[id];
- session.timestamp = new Date();
- if (session.queue.length > 0) {
- res.simpleJSON(200, session.queue);
- session.queue = [];
- } else {
- session.res = res;
- session.timeout = setTimeout(function () { closeReq(res) }, 30000);
- }
+function handleConsole (id, res) {
+ if (sessions[id] === undefined) {
+ // Create session
+ sessions[id] = {
+ timestamp: 0,
+ queue: []
+ };
+ }
+
+ var session = sessions[id];
+ session.timestamp = new Date();
+ if (session.queue.length > 0) {
+ res.simpleJSON(200, session.queue);
+ session.queue = [];
+ } else {
+ session.res = res;
+ session.timeout = setTimeout(function () { closeReq(res) }, 30000);
+ }
}
-function closeReq(res) {
- res.simpleJSON(200, []);
+function closeReq (res) {
+ res.simpleJSON(200, []);
}
debug.log = function (msg) {
- for (var id in sessions) {
- if (!sessions.hasOwnProperty(id)) continue;
- var session = sessions[id];
-
- session.queue.push(msg);
-
- if (session.timeout !== undefined) {
- clearTimeout(session.timeout);
- }
-
- if (session.res !== undefined) {
- session.res.simpleJSON(200, session.queue);
- session.queue = [];
- }
- }
+ for (var id in sessions) {
+ if (!sessions.hasOwnProperty(id)) continue;
+ var session = sessions[id];
+
+ session.queue.push(msg);
+
+ if (session.timeout !== undefined) {
+ clearTimeout(session.timeout);
+ }
+
+ if (session.res !== undefined) {
+ session.res.simpleJSON(200, session.queue);
+ session.queue = [];
+ }
+ }
}
// interval to kill off old sessions
@@ -100,71 +100,71 @@ setInterval(function () {
}
}, 1000);
-function getObj(key) {
- var obj = process;
- var keys = key.split('.');
-
- keys.forEach(function (x) {
- obj = obj[x];
- });
-
- var output = [];
- var cur;
- var children = false;
- for (var i in obj) {
- // Prevent loops
- if (obj === obj[i])
- continue;
- cur = {id: key+'.'+i};
- cur.text = '<strong>'+i+' - '+typeof(obj[i])+'</strong>';
- var str;
- try {
- str = JSON.stringify(obj[i]);
- } catch (e) {
- str = undefined;
- }
- if (str == undefined) {
- try {
- str = obj[i].toString();
- } catch (e) {
- str = '';
- }
- }
- cur.text += '<pre>'+str+'</pre>';
- if (typeof(obj[i]) !== 'string') {
- children = false
- for (var j in obj[i]) {
- children = true;
- break;
- }
- if ((key+'.'+i) == 'process.node.Timer') {
- children = false
- }
- if (children === true) {
- cur.hasChildren = true;
- }
- }
- output.push(cur);
- }
- return output;
+function getObj (key) {
+ var obj = process;
+ var keys = key.split('.');
+
+ keys.forEach(function (x) {
+ obj = obj[x];
+ });
+
+ var output = [];
+ var cur;
+ var children = false;
+ for (var i in obj) {
+ // Prevent loops
+ if (obj === obj[i])
+ continue;
+ cur = {id: key+'.'+i};
+ cur.text = '<strong>'+i+' - '+typeof(obj[i])+'</strong>';
+ var str;
+ try {
+ str = JSON.stringify(obj[i]);
+ } catch (e) {
+ str = undefined;
+ }
+ if (str == undefined) {
+ try {
+ str = obj[i].toString();
+ } catch (e) {
+ str = '';
+ }
+ }
+ cur.text += '<pre>'+str+'</pre>';
+ if (typeof(obj[i]) !== 'string') {
+ children = false
+ for (var j in obj[i]) {
+ children = true;
+ break;
+ }
+ if ((key+'.'+i) == 'process.node.Timer') {
+ children = false
+ }
+ if (children === true) {
+ cur.hasChildren = true;
+ }
+ }
+ output.push(cur);
+ }
+ return output;
}
-function evalStr(str) {
- var result;
- var error = false;
- try {
- result = eval(str);
- try {
- result = JSON.stringify(result);
- } catch (e) {
- result = result.toString();
- }
- } catch (err) {
- error = true;
- result = err;
- }
- var output = {result: result};
- output.error = error;
- output.str = str;
- return output;
-}
+function evalStr (str) {
+ var result;
+ var error = false;
+ try {
+ result = eval(str);
+ try {
+ result = JSON.stringify(result);
+ } catch (e) {
+ result = result.toString();
+ }
+ } catch (err) {
+ error = true;
+ result = err;
+ }
+ var output = {result: result};
+ output.error = error;
+ output.str = str;
+ return output;
+}
View
@@ -1,3 +1,3 @@
var debug = require("debug.js");
-debug.listen(8080);
+debug.listen(8080);
Oops, something went wrong. Retry.

0 comments on commit 1f640d1

Please sign in to comment.