0

我是 JSDoc 的新手,我正在尝试找出标记代码的最佳方法。出于某种原因,在我将某些内容标记为@class 之后,我无法让任何内容显示为@inner:

/**
 * The logger, to simply output logs to the console (or potentially a variable)
 * @class Logger
 * @requires 'config/globalConfig'
 */
define(["config/globalConfig"], function (config) {
    /**
     * Instantiate a new copy of the logger for a class/object
     * @constructor
     * @param name {string} - The name of the class instantiating the logger
     */
    return function (name) {
        /**
         * @memberOf Logger
         * @type {string}
         */
        this.name = name;

        /**
         * Place the message on the console, only for "DEV" level debugging
         * @function
         * @memberOf Logger
         * @param message {string}
         */
        this.debug = function (message) {
            ... some code ...
        };         
    };
});

现在所有成员都显示为 <static>。如果我将 @inner 标记添加到任何属性/函数,它们会完全从输出中消失。

编辑:我也忘了提。@constructor 标志似乎也不起作用。如果我删除整个部分,它在输出中显示相同。输出不包括我想在构造函数中提到的@param。

请让我知道这是否完全关闭,我只是在这里猜测,因为 JSDoc3 文档有点难以阅读。

4

1 回答 1

1

所以我想通了,仍然不确定它是否绝对正确。我不得不使用“Logger~name”让它正确地显示为一个内部函数。根据 JSDoc 文档,这个 ~ “很少使用”。似乎是唯一对我有用的东西。

define(["config/globalConfig"], function (config) {
    /**
     * The logger, to simply output logs to the console (or potentially a variable)
     * @class Logger
     * @param name {string} - The name of the class instantiating the logger
     */
    return function (name) {
        this.name = name;

        /**
         * Place the message on the console, only for "DEV" level debugging
         * @function Logger~debug
         * @param message {string}
         */
        this.debug = function (message) {
            ... code ...
        };
    };
});
于 2013-08-08T14:26:40.997 回答