mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Cleanup app jsdoc
This commit is contained in:
parent
79f9331073
commit
5ec51d0ccc
57
js/app.js
57
js/app.js
@ -40,16 +40,19 @@ process.on("uncaughtException", function (err) {
|
|||||||
Log.error("If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues");
|
Log.error("If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues");
|
||||||
});
|
});
|
||||||
|
|
||||||
/* App - The core app.
|
/**
|
||||||
|
* The core app.
|
||||||
|
*
|
||||||
|
* @class
|
||||||
*/
|
*/
|
||||||
var App = function () {
|
var App = function () {
|
||||||
var nodeHelpers = [];
|
var nodeHelpers = [];
|
||||||
|
|
||||||
/* loadConfig(callback)
|
/**
|
||||||
* Loads the config file. combines it with the defaults,
|
* Loads the config file. Combines it with the defaults, and runs the
|
||||||
* and runs the callback with the found config as argument.
|
* callback with the found config as argument.
|
||||||
*
|
*
|
||||||
* argument callback function - The callback function.
|
* @param {Function} callback Function to be called after loading the config
|
||||||
*/
|
*/
|
||||||
var loadConfig = function (callback) {
|
var loadConfig = function (callback) {
|
||||||
Log.log("Loading config ...");
|
Log.log("Loading config ...");
|
||||||
@ -80,6 +83,12 @@ var App = function () {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks the config for deprecated options and throws a warning in the logs
|
||||||
|
* if it encounters one option from the deprecated.js list
|
||||||
|
*
|
||||||
|
* @param {object} userConfig The user config
|
||||||
|
*/
|
||||||
var checkDeprecatedOptions = function (userConfig) {
|
var checkDeprecatedOptions = function (userConfig) {
|
||||||
var deprecated = require(global.root_path + "/js/deprecated.js");
|
var deprecated = require(global.root_path + "/js/deprecated.js");
|
||||||
var deprecatedOptions = deprecated.configs;
|
var deprecatedOptions = deprecated.configs;
|
||||||
@ -96,10 +105,11 @@ var App = function () {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* loadModule(module)
|
/**
|
||||||
* Loads a specific module.
|
* Loads a specific module.
|
||||||
*
|
*
|
||||||
* argument module string - The name of the module (including subpath).
|
* @param {string} module The name of the module (including subpath).
|
||||||
|
* @param {Function} callback Function to be called after loading
|
||||||
*/
|
*/
|
||||||
var loadModule = function (module, callback) {
|
var loadModule = function (module, callback) {
|
||||||
var elements = module.split("/");
|
var elements = module.split("/");
|
||||||
@ -144,10 +154,11 @@ var App = function () {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* loadModules(modules)
|
/**
|
||||||
* Loads all modules.
|
* Loads all modules.
|
||||||
*
|
*
|
||||||
* argument module string - The name of the module (including subpath).
|
* @param {Array} modules All modules to be loaded
|
||||||
|
* @param {Function} callback Function to be called after loading
|
||||||
*/
|
*/
|
||||||
var loadModules = function (modules, callback) {
|
var loadModules = function (modules, callback) {
|
||||||
Log.log("Loading module helpers ...");
|
Log.log("Loading module helpers ...");
|
||||||
@ -174,6 +185,9 @@ var App = function () {
|
|||||||
*
|
*
|
||||||
* @param {string} a Version number a.
|
* @param {string} a Version number a.
|
||||||
* @param {string} b Version number b.
|
* @param {string} b Version number b.
|
||||||
|
*
|
||||||
|
* @returns {number} A positive number if a is larger than b, a negative
|
||||||
|
* number if a is smaller and 0 if they are the same
|
||||||
*/
|
*/
|
||||||
function cmpVersions(a, b) {
|
function cmpVersions(a, b) {
|
||||||
var i, diff;
|
var i, diff;
|
||||||
@ -191,12 +205,13 @@ var App = function () {
|
|||||||
return segmentsA.length - segmentsB.length;
|
return segmentsA.length - segmentsB.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* start(callback)
|
/**
|
||||||
* This methods starts the core app.
|
* Start the core app.
|
||||||
* It loads the config, then it loads all modules.
|
|
||||||
* When it's done it executes the callback with the config as argument.
|
|
||||||
*
|
*
|
||||||
* argument callback function - The callback function.
|
* It loads the config, then it loads all modules. When it's done it
|
||||||
|
* executes the callback with the config as argument.
|
||||||
|
*
|
||||||
|
* @param {Function} callback Function to be called after start
|
||||||
*/
|
*/
|
||||||
this.start = function (callback) {
|
this.start = function (callback) {
|
||||||
loadConfig(function (c) {
|
loadConfig(function (c) {
|
||||||
@ -234,9 +249,10 @@ var App = function () {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/* stop()
|
/**
|
||||||
* This methods stops the core app.
|
* Stops the core app. This calls each node_helper's STOP() function, if it
|
||||||
* This calls each node_helper's STOP() function, if it exists.
|
* exists.
|
||||||
|
*
|
||||||
* Added to fix #1056
|
* Added to fix #1056
|
||||||
*/
|
*/
|
||||||
this.stop = function () {
|
this.stop = function () {
|
||||||
@ -248,7 +264,8 @@ var App = function () {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Listen for SIGINT signal and call stop() function.
|
/**
|
||||||
|
* Listen for SIGINT signal and call stop() function.
|
||||||
*
|
*
|
||||||
* Added to fix #1056
|
* Added to fix #1056
|
||||||
* Note: this is only used if running `server-only`. Otherwise
|
* Note: this is only used if running `server-only`. Otherwise
|
||||||
@ -263,7 +280,9 @@ var App = function () {
|
|||||||
process.exit(0);
|
process.exit(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
/* We also need to listen to SIGTERM signals so we stop everything when we are asked to stop by the OS.
|
/**
|
||||||
|
* Listen to SIGTERM signals so we can stop everything when we
|
||||||
|
* are asked to stop by the OS.
|
||||||
*/
|
*/
|
||||||
process.on("SIGTERM", () => {
|
process.on("SIGTERM", () => {
|
||||||
Log.log("[SIGTERM] Received. Shutting down server...");
|
Log.log("[SIGTERM] Received. Shutting down server...");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user