如何在 JSDoc 中记录 javascript IIFE 模块

How to document javascript IIFE modules in JSDoc

我正在尝试找出如何使用 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 标准。能请教一下吗?

经过一番尝试,ai 发现 @memberof

你可以这样使用它:

@memberof module:YourModuleName

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