我们将 jsdoc 用于一个非常依赖 javascript 的项目。为了获得代码文档,我们让 jsdoc 通过 grunt 构建 html 文件。
到目前为止,我们使用“memberof”关键字成功地将属性和方法分配给模块,如下所示:
例子
/**
* Short description of this module
*
*
* @module hse-catalog
*/
jQuery(document).ready(function($) {
'use strict';
/**
* @namespace catalog
* @memberof module:hse-catalog
*/
catalog = {
selector: {
/* Stuff in here */
},
/**
* Initializes the module.
*
* @memberof module:hse-catalog
*/
init: function() {
// do init
},
/**
* Indicates whether the module is ready to load.
*
* @return {boolean} true or false
* @memberof module:hse-catalog
*/
isReady: function() {
// do stuff
}
/**
* Initializes the catalog page breadcrumb.
* @deprecated out of order
* @memberof module:hse-catalog
*/
initBreadcrumb: function() {
// do stuff
}
};
});
这为我们创建了一个非常好的 html 文档,其中列出了所有模块。如果我在那里单击其中一个模块,我会看到该模块的所有属性和方法。到目前为止,一切都很好。
但真正的问题是我们还希望将模块分配给某些命名空间。我们如何做到这一点?jsdoc 是否完全支持这一点?