Removed function in loop

This commit is contained in:
Thomas FORGIONE 2015-07-06 11:26:19 +02:00
parent 80ba3278da
commit c646b54915
3 changed files with 18 additions and 16 deletions

View File

@ -178,13 +178,17 @@ for (var i = 1; i < 26; i++) {
geo.availableMeshes = {}; geo.availableMeshes = {};
for (var name in availableMeshNames) { function pushMesh(name) {
(function(name) { geo.availableMeshes[name] = new geo.MeshContainer(name.substring(1, name.length), function() {
geo.availableMeshes[name] = new geo.MeshContainer(name.substring(1, name.length), function() { availableMeshNames[name] = true;
availableMeshNames[name] = true; trySetLoaded();
trySetLoaded(); });
});
})(name); }
for (var name in availableMeshNames) {
pushMesh(name);
} }

View File

@ -349,6 +349,4 @@ utils.Iterator = Iterator;
return utils; return utils;
console.log("Hello");
})(); })();

View File

@ -18,16 +18,16 @@ var log;
if (isDev) { if (isDev) {
log = function(elt, color) { log = function(elt, color) {
console.log(color + elt + Colors.DEFAULT); console.log(color + elt + Colors.DEFAULT);
} };
} else { } else {
log = function(elt, color) { log = function(elt, color) {
console.log(elt); console.log(elt);
} };
} }
Log.ready = function(msg) { Log.ready = function(msg) {
log('[RDY] ' + new Date() + ' ' + msg, Colors.GREEN); log('[RDY] ' + new Date() + ' ' + msg, Colors.GREEN);
} };
Log.request = function(req, res) { Log.request = function(req, res) {
if (req.headers['x-forwarded-for'] !== undefined || isDev) { if (req.headers['x-forwarded-for'] !== undefined || isDev) {
@ -38,7 +38,7 @@ Log.request = function(req, res) {
Colors.CYAN Colors.CYAN
); );
} }
} };
Log.socket = {}; Log.socket = {};
Log.socket.connection = function(socket) { Log.socket.connection = function(socket) {
@ -47,7 +47,7 @@ Log.socket.connection = function(socket) {
socket.handshake.address + ' connection', socket.handshake.address + ' connection',
Colors.YELLOW Colors.YELLOW
); );
} };
Log.socket.disconnect = function(socket) { Log.socket.disconnect = function(socket) {
log( log(
@ -55,13 +55,13 @@ Log.socket.disconnect = function(socket) {
socket.handshake.address + ' disconnect', socket.handshake.address + ' disconnect',
Colors.YELLOW Colors.YELLOW
); );
} };
Log.dberror = function(error) { Log.dberror = function(error) {
log( log(
'[DBE] ' + new Date() + ' ' + error, '[DBE] ' + new Date() + ' ' + error,
Colors.RED Colors.RED
); );
} };
module.exports = Log; module.exports = Log;