From 522f7644a33fd2b98ebee688ed3ed6fab7f241e0 Mon Sep 17 00:00:00 2001 From: rejas Date: Sat, 1 Aug 2020 16:31:42 +0200 Subject: [PATCH] Add typedef for Module, use it in other jsdocs --- js/app.js | 2 +- js/module.js | 15 ++++++++------- js/translator.js | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/js/app.js b/js/app.js index 52405bec..64844269 100644 --- a/js/app.js +++ b/js/app.js @@ -157,7 +157,7 @@ var App = function () { /** * Loads all modules. * - * @param {Array} modules All modules to be loaded + * @param {Module[]} modules All modules to be loaded * @param {Function} callback Function to be called after loading */ var loadModules = function (modules, callback) { diff --git a/js/module.js b/js/module.js index 7c581a31..0148a2d9 100644 --- a/js/module.js +++ b/js/module.js @@ -2,9 +2,11 @@ /* Magic Mirror * Module Blueprint. + * @typedef {Object} Module * * By Michael Teeuw https://michaelteeuw.nl * MIT Licensed. + * */ var Module = Class.extend({ /********************************************************* @@ -45,9 +47,8 @@ var Module = Class.extend({ /** * Returns a list of scripts the module requires to be loaded. - * return Array - * - * @returns {*[]} An array with filenames. + * @returns {string[]} An array with filenames. */ getScripts: function () { return []; @@ -56,7 +57,7 @@ var Module = Class.extend({ /** * Returns a list of stylesheets the module requires to be loaded. * - * @returns {*[]} An array with filenames. + * @returns {string[]} An array with filenames. */ getStyles: function () { return []; @@ -146,7 +147,7 @@ var Module = Class.extend({ * * @param {string} notification The identifier of the notification. * @param {*} payload The payload of the notification. - * @param {object} sender The module that sent the notification. + * @param {Module} sender The module that sent the notification. */ notificationReceived: function (notification, payload, sender) { if (sender) { @@ -212,7 +213,7 @@ var Module = Class.extend({ /** * Set the module data. * - * @param {object} data The module data + * @param {Module} data The module data */ setData: function (data) { this.data = data; @@ -388,7 +389,7 @@ var Module = Class.extend({ * * @param {number} speed The speed of the hide animation. * @param {Function} callback Called when the animation is done. - * @param {object} options Optional settings for the hide method. + * @param {object} [options] Optional settings for the hide method. */ hide: function (speed, callback, options) { if (typeof callback === "object") { @@ -416,7 +417,7 @@ var Module = Class.extend({ * * @param {number} speed The speed of the show animation. * @param {Function} callback Called when the animation is done. - * @param {object} options Optional settings for the show method. + * @param {object} [options] Optional settings for the show method. */ show: function (speed, callback, options) { if (typeof callback === "object") { diff --git a/js/translator.js b/js/translator.js index e043de39..eb1482ae 100644 --- a/js/translator.js +++ b/js/translator.js @@ -34,7 +34,7 @@ var Translator = (function () { /** * Load a translation for a given key for a given module. * - * @param {object} module The module to load the translation for. + * @param {Module} module The module to load the translation for. * @param {string} key The key of the text to translate. * @param {object} variables The variables to use within the translation template (optional) * @@ -92,7 +92,7 @@ var Translator = (function () { /** * Load a translation file (json) and remember the data. * - * @param {object} module The module to load the translation file for. + * @param {Module} module The module to load the translation file for. * @param {string} file Path of the file we want to load. * @param {boolean} isFallback Flag to indicate fallback translations. * @param {Function} callback Function called when done.