【问题标题】:How to document javascript IIFE modules in JSDoc如何在 JSDoc 中记录 javascript IIFE 模块
【发布时间】:2017-12-14 11:19:36
【问题描述】:

我正在尝试弄清楚如何使用 JSDoc3 正确地对其进行评论。

/**
 * Module ...
 *
 * @module Cookie
 * @returns {{create, get, remove}}
 */
const cookie = (function () {

    /**
     * Function to create cookie.
     *
     * @param {String} name - The cookie name.
     * @param {String} value - The cookie value.
     * @param {Boolean} elongate - The flag to extend cookie lifetime.
     */
    const create = (name, value, elongate) => {
    ...
    };

    /**
     * Function to get cookie.
     *
     * @param {String} key - The cookie identificatior to get.
     * @returns {*}
     */
    const get = (key) => {
    ...
    };

    /**
     * Function to remove cookie.
     *
     * @param {String} key - The cookie identificator to remove.
     */
    const remove = (key) => {
    ...
    };

    return {
        create: create,
        get: get,
        remove: remove
    }
})();

我正在这样做,但生成的文档看起来很糟糕。我无法将这部分代码重写为 ES6 标准。可以请教吗?

【问题讨论】:

  • 也很想知道,好像de IIFE里面的一切都被忽略了

标签: javascript documentation jsdoc


【解决方案1】:

经过一番尝试,ai找到了@memberof

你可以这样使用它:

@memberof module:YourModuleName

不知道是否正确,但之后我看到我的模块文档中显示了该方法。页。

【讨论】:

    猜你喜欢
    • 2012-04-27
    • 2015-11-27
    • 2017-11-05
    • 2020-02-09
    • 1970-01-01
    • 2016-12-19
    • 2017-01-17
    • 1970-01-01
    • 2023-03-20
    相关资源
    最近更新 更多