mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 10:37:34 +00:00
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
54 lines
No EOL
1.2 KiB
JavaScript
Executable file
54 lines
No EOL
1.2 KiB
JavaScript
Executable file
"use strict"
|
|
|
|
Error.stackTraceLimit = Infinity;
|
|
|
|
var requirejs = require('requirejs');
|
|
var fs = require('fs');
|
|
|
|
var App = App || {};
|
|
App.inspector = {};
|
|
App.context = "Channel";
|
|
|
|
requirejs.config({
|
|
nodeRequire: require,
|
|
baseUrl: 'app',
|
|
deps: ['Lib/Utilities/Channel/Extensions']
|
|
});
|
|
|
|
var port = process.argv[2]
|
|
|| process.env.PORT
|
|
|| process.env.npm_package_config_port;
|
|
|
|
var options = {
|
|
port: port,
|
|
rootDirectory: './',
|
|
caching: 0,
|
|
logLevel: process.argv[3] || 0
|
|
};
|
|
|
|
requirejs([
|
|
"Bootstrap/HttpServer",
|
|
"Bootstrap/Socket",
|
|
"Server/Coordinator",
|
|
"Game/Config/Settings"
|
|
],
|
|
|
|
function (HttpServer, Socket, Coordinator, Settings) {
|
|
|
|
var records = fs.readdirSync(Settings.CHANNEL_RECORDING_PATH);
|
|
if (records.length > 200) {
|
|
console.warn('Too many recordings!');
|
|
}
|
|
|
|
var coordinator = new Coordinator();
|
|
var httpServer = new HttpServer(options, coordinator);
|
|
var socket = new Socket(httpServer.getServer(), options, coordinator);
|
|
|
|
App.inspector = {
|
|
coordinator: coordinator,
|
|
httpServer: httpServer,
|
|
socket: socket
|
|
}
|
|
});
|
|
|
|
exports = module.exports = App; |