mirror of
https://github.com/MichMich/MagicMirror.git
synced 2025-06-27 19:53:36 +00:00
Cleanup loader jsdoc
This commit is contained in:
parent
522f7644a3
commit
935c9b6a42
44
js/loader.js
44
js/loader.js
@ -15,7 +15,7 @@ var Loader = (function () {
|
|||||||
|
|
||||||
/* Private Methods */
|
/* Private Methods */
|
||||||
|
|
||||||
/* loadModules()
|
/**
|
||||||
* Loops thru all modules and requests load for every module.
|
* Loops thru all modules and requests load for every module.
|
||||||
*/
|
*/
|
||||||
var loadModules = function () {
|
var loadModules = function () {
|
||||||
@ -43,7 +43,7 @@ var Loader = (function () {
|
|||||||
loadNextModule();
|
loadNextModule();
|
||||||
};
|
};
|
||||||
|
|
||||||
/* startModules()
|
/**
|
||||||
* Loops thru all modules and requests start for every module.
|
* Loops thru all modules and requests start for every module.
|
||||||
*/
|
*/
|
||||||
var startModules = function () {
|
var startModules = function () {
|
||||||
@ -56,19 +56,19 @@ var Loader = (function () {
|
|||||||
MM.modulesStarted(moduleObjects);
|
MM.modulesStarted(moduleObjects);
|
||||||
};
|
};
|
||||||
|
|
||||||
/* getAllModules()
|
/**
|
||||||
* Retrieve list of all modules.
|
* Retrieve list of all modules.
|
||||||
*
|
*
|
||||||
* return array - module data as configured in config
|
* @returns {object[]} module data as configured in config
|
||||||
*/
|
*/
|
||||||
var getAllModules = function () {
|
var getAllModules = function () {
|
||||||
return config.modules;
|
return config.modules;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* getModuleData()
|
/**
|
||||||
* Generate array with module information including module paths.
|
* Generate array with module information including module paths.
|
||||||
*
|
*
|
||||||
* return array - Module information.
|
* @returns {object[]} Module information.
|
||||||
*/
|
*/
|
||||||
var getModuleData = function () {
|
var getModuleData = function () {
|
||||||
var modules = getAllModules();
|
var modules = getAllModules();
|
||||||
@ -106,11 +106,11 @@ var Loader = (function () {
|
|||||||
return moduleFiles;
|
return moduleFiles;
|
||||||
};
|
};
|
||||||
|
|
||||||
/* loadModule(module)
|
/**
|
||||||
* Load modules via ajax request and create module objects.
|
* Load modules via ajax request and create module objects.s
|
||||||
*
|
*
|
||||||
* argument callback function - Function called when done.
|
* @param {object} module Information about the module we want to load.
|
||||||
* argument module object - Information about the module we want to load.
|
* @param {Function} callback Function called when done.
|
||||||
*/
|
*/
|
||||||
var loadModule = function (module, callback) {
|
var loadModule = function (module, callback) {
|
||||||
var url = module.path + "/" + module.file;
|
var url = module.path + "/" + module.file;
|
||||||
@ -136,12 +136,12 @@ var Loader = (function () {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/* bootstrapModule(module, mObj)
|
/**
|
||||||
* Bootstrap modules by setting the module data and loading the scripts & styles.
|
* Bootstrap modules by setting the module data and loading the scripts & styles.
|
||||||
*
|
*
|
||||||
* argument module object - Information about the module we want to load.
|
* @param {object} module Information about the module we want to load.
|
||||||
* argument mObj object - Modules instance.
|
* @param {Module} mObj Modules instance.
|
||||||
* argument callback function - Function called when done.
|
* @param {Function} callback Function called when done.
|
||||||
*/
|
*/
|
||||||
var bootstrapModule = function (module, mObj, callback) {
|
var bootstrapModule = function (module, mObj, callback) {
|
||||||
Log.info("Bootstrapping module: " + module.name);
|
Log.info("Bootstrapping module: " + module.name);
|
||||||
@ -161,11 +161,11 @@ var Loader = (function () {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/* loadFile(fileName)
|
/**
|
||||||
* Load a script or stylesheet by adding it to the dom.
|
* Load a script or stylesheet by adding it to the dom.
|
||||||
*
|
*
|
||||||
* argument fileName string - Path of the file we want to load.
|
* @param {string} fileName Path of the file we want to load.
|
||||||
* argument callback function - Function called when done.
|
* @param {Function} callback Function called when done.
|
||||||
*/
|
*/
|
||||||
var loadFile = function (fileName, callback) {
|
var loadFile = function (fileName, callback) {
|
||||||
var extension = fileName.slice((Math.max(0, fileName.lastIndexOf(".")) || Infinity) + 1);
|
var extension = fileName.slice((Math.max(0, fileName.lastIndexOf(".")) || Infinity) + 1);
|
||||||
@ -215,20 +215,20 @@ var Loader = (function () {
|
|||||||
|
|
||||||
/* Public Methods */
|
/* Public Methods */
|
||||||
return {
|
return {
|
||||||
/* loadModules()
|
/**
|
||||||
* Load all modules as defined in the config.
|
* Load all modules as defined in the config.
|
||||||
*/
|
*/
|
||||||
loadModules: function () {
|
loadModules: function () {
|
||||||
loadModules();
|
loadModules();
|
||||||
},
|
},
|
||||||
|
|
||||||
/* loadFile()
|
/**
|
||||||
* Load a file (script or stylesheet).
|
* Load a file (script or stylesheet).
|
||||||
* Prevent double loading and search for files in the vendor folder.
|
* Prevent double loading and search for files in the vendor folder.
|
||||||
*
|
*
|
||||||
* argument fileName string - Path of the file we want to load.
|
* @param {string} fileName Path of the file we want to load.
|
||||||
* argument module Module Object - the module that calls the loadFile function.
|
* @param {Module} module The module that calls the loadFile function.
|
||||||
* argument callback function - Function called when done.
|
* @param {Function} callback Function called when done.
|
||||||
*/
|
*/
|
||||||
loadFile: function (fileName, module, callback) {
|
loadFile: function (fileName, module, callback) {
|
||||||
if (loadedFiles.indexOf(fileName.toLowerCase()) !== -1) {
|
if (loadedFiles.indexOf(fileName.toLowerCase()) !== -1) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user