如何使用JSDoc3来编写嵌套的命名空间 [英] How to use JSDoc3 to document nested namespaces
本文介绍了如何使用JSDoc3来编写嵌套的命名空间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我无法使用JSDoc3来记录以这些方式结构化的代码
I'm having trouble using JSDoc3 to document code that's structured along these lines
/**
* @namespace MyNamespace.MySubNamespace
*/
(function (MyNamespace) {
MyNamespace.MySubNamespace.Foo = {
doSomething: function (someParam) {
// doing it
}
}
})(window.MyNamespace)
如何使用JSDoc3来记录 MyNamespace
包含 MySubNamespace
,其中包含美孚
?进一步如何将 doSomething
与 Foo
相关联,并记录其参数 someParam
?
How would I use JSDoc3 to document that MyNamespace
contains MySubNamespace
which contains Foo
? Further how would I associate doSomething
with Foo
and document its parameter someParam
?
我的限制是我无法向文件添加文档,其中 MyNamespace
和 MySubNamespace
被声明。
A limitation I have is that I can't add documentation to the file in which MyNamespace
and MySubNamespace
are declared.
非常感谢!
推荐答案
希望这个解决方案可以帮助别人。
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)
这篇关于如何使用JSDoc3来编写嵌套的命名空间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文