Refactores the GLOBALS.context to use more expressive naming

Combines GLOBALS and Chuck namespace into App. Also increases
number of stack trace steps to be printed when an error occurs.

I experimented with the "replace" plugin from require.js, which
works but it would mean that our context switchable
"import-statements" would look like the example below, which I
decided against at least for now, just because of the looks.

The downside of not using the plugin is that we cannot use the
"use strict" statement in the channel.js entry script and also
cannot put a "var" in front of App variable there.

For example: "replace!Game/:AppContext/Physics/Engine",
Instead of:  "Game/" + App.context + "/Physics/Engine",

Fixes #86
This commit is contained in:
logsol 2016-10-11 23:05:33 +02:00
parent 45ea2dfba3
commit 806a9d8194
17 changed files with 59 additions and 49 deletions

View file

@ -1,10 +1,13 @@
"use strict"
var GLOBALS = { context: "Channel" };
Error.stackTraceLimit = Infinity;
var requirejs = require('requirejs');
var fs = require('fs');
var inspector;
var App = App || {};
App.inspector = {};
App.context = "Channel";
requirejs.config({
nodeRequire: require,
@ -41,11 +44,11 @@ function (HttpServer, Socket, Coordinator, Settings) {
var httpServer = new HttpServer(options, coordinator);
var socket = new Socket(httpServer.getServer(), options, coordinator);
inspector = {
App.inspector = {
coordinator: coordinator,
httpServer: httpServer,
socket: socket
}
});
exports = module.exports = inspector;
exports = module.exports = App;