Simplified logic for handlingConsoleRequests, Fixed Syntax Errors

This commit is contained in:
RayGervais 2017-03-16 18:27:19 -04:00 коммит произвёл David Humphrey
Родитель 8a4cf1436d
Коммит f198942856
2 изменённых файлов: 25 добавлений и 43 удалений

Просмотреть файл

@ -14,36 +14,13 @@ define(function (require, exports, module) {
function handleConsoleRequest(args, type) {
// Add an indentifier to the front of the args list
args.unshift("[Bramble Console]:");
switch(type) {
case "log":
console.log.apply(console, args);
break;
case "info":
console.info.apply(console, args);
break;
case "debug":
console.debug.apply(console, args);
break;
case "warn":
console.warn.apply(console, args);
break;
case "error":
console.error.apply(console, args);
break;
case "clear":
console.clear.apply(console);
break;
case "time":
args[0] = args[0] + " " + args[1];
console.time.apply(console, args);
break;
case "timeEnd":
args[0] = args[0] + " " + args[1];
console.timeEnd.apply(console, args);
break;
default:
// Time related arguments
if(type == "time" || type == "timeEnd") {
args[0] = args[0] + " " + args[1];
}
console[type].apply(console, args);
}
exports.getRemoteScript = getRemoteScript;

Просмотреть файл

@ -8,53 +8,58 @@
}
}
function generateRouter(fname) {
var args = Array.from(arguments).slice();
transportSend(args, fname);
}
// Implement console.log replacement
console.log = function() {
console.log = function() {
var args = Array.from(arguments).slice();
transportSend(args, "log");
};
// Implement console.debug replacement
console.debug = function() {
console.debug = function() {
var args = Array.from(arguments).slice();
transportSend(args, "debug");
};
// Implement console.error replacement
console.error = function() {
console.error = function() {
var args = Array.from(arguments).slice();
transportSend(args, "error");
}
};
// Implement console.info replacement
console.info = function() {
var args = Array.from(arguments).slice();
transportSend(args, "info");
}
// Implement console.info replacement
};
// Implement console.warn replacement
console.warn = function() {
var args = Array.from(arguments).slice();
transportSend(args, "warn");
}
};
// Implement console.clear replacement
console.clear = function() {
var args = Array.from(arguments).slice();
transportSend(args, "clear");
}
};
// Implement console.time replacement
console.time = function() {
var args = Array.from(arguments).slice();
var args = Array.from(arguments).slice();
transportSend(args, "time");
}
};
// Implement console.time replacement
// Implement console.timeEnd replacement
console.timeEnd = function() {
var args = Array.from(arguments).slice();
transportSend(args, "timeEnd");
}
};
// Replace default console.assert with custom
console.assert = function() {