[英]How to use JSDoc3 to document nested namespaces
I'm having trouble using JSDoc3 to document code that's structured along these lines 我在使用JSDoc3来记录按照这些方式构建的代码时遇到了麻烦
/**
* @namespace MyNamespace.MySubNamespace
*/
(function (MyNamespace) {
MyNamespace.MySubNamespace.Foo = {
doSomething: function (someParam) {
// doing it
}
}
})(window.MyNamespace)
How would I use JSDoc3 to document that MyNamespace
contains MySubNamespace
which contains Foo
? 我如何使用JSDoc3来记录
MyNamespace
包含包含Foo
MySubNamespace
? Further how would I associate doSomething
with Foo
and document its parameter someParam
? 我将如何将
doSomething
与Foo
相关联并将其参数记录为someParam
?
A limitation I have is that I can't add documentation to the file in which MyNamespace
and MySubNamespace
are declared. 我的一个限制是我无法将文档添加到声明
MyNamespace
和MySubNamespace
的文件中。
Thanks much! 非常感谢!
Figured it out. 弄清楚了。 Hope this solution helps others.
希望这个解决方案有助于其
/**
* @namespace MyNamespace.MySubNamespace
*/
(function (MyNamespace) {
/**
* Foo namespace
* @namespace Foo
* @memberOf MyNamespace.MySubNamespace
*/
var Foo = {
/**
* Does something.
* @memberOf MyNamespace.MySubNamespace.Foo
* @param {object} someParam Some parameter.
*/
doSomething: function (someParam) {
// doing it
}
};
MyNamespace.MySubNamespace.Foo = Foo;
})(window.MyNamespace)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.