我正在尝试找出如何使用 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 标准。能请教一下吗?
最佳答案
经过一些尝试,我找到了 @memberof
你可以这样使用它:
@memberof module:YourModuleName
不知道它是否正确,但之后我看到我的模块文档中显示了该方法。页。
关于javascript - 如何在 JSDoc 中记录 javascript IIFE 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47812071/