admin管理员组文章数量:1314557
I faced a problem with understanding the purpose of namespaces and modules in a union. For example I have a class Game.utils.Matrix
. I want to annotate Game
as a namespace, utils
as a module and Matrix
as a class:
/**
* @namespace Game
*/
/**
* @module utils
* @memberOf Game
*/
/**
* Create a matrix
* @constructor
*/
function Matrix(){}
It creates a documentation and the name path of the Matrix
class is Game.utils~ Matrix
, but if I follow the Module
link its name path is Module: utils
without the Game
namespace prefix, and if I follow the Game
link it does not contain the utils
module link.
Moreover, I can't add another class to this module as This class is not shown in the utils
module tab:
/**
* Create Dictionary
* @memberOf Game.utils
* @constructor
*/
function Dictionary(){}
The question is: what is the correct way to document namespaces and modules and what is the use case for each of them?
I faced a problem with understanding the purpose of namespaces and modules in a union. For example I have a class Game.utils.Matrix
. I want to annotate Game
as a namespace, utils
as a module and Matrix
as a class:
/**
* @namespace Game
*/
/**
* @module utils
* @memberOf Game
*/
/**
* Create a matrix
* @constructor
*/
function Matrix(){}
It creates a documentation and the name path of the Matrix
class is Game.utils~ Matrix
, but if I follow the Module
link its name path is Module: utils
without the Game
namespace prefix, and if I follow the Game
link it does not contain the utils
module link.
Moreover, I can't add another class to this module as This class is not shown in the utils
module tab:
/**
* Create Dictionary
* @memberOf Game.utils
* @constructor
*/
function Dictionary(){}
The question is: what is the correct way to document namespaces and modules and what is the use case for each of them?
Share Improve this question asked Apr 6, 2015 at 10:52 aspirisenaspirisen 1,02514 silver badges32 bronze badges1 Answer
Reset to default 7I played with it a bit and I guess having modules in a namespaces is a bit tricky. What worked for me is to define a module utils
and a namespace which references it. The module is called utils
however, not Game.utils
but in Game
you can see a property which links to it.
/**
* @namespace Game
* @property {module:utils} utils
*/
/**
* @module utils
*/
/**
* Create a matrix
* @class
*/
function Matrix(){}
本文标签: javascriptJSDoc What is a relationship between modules and namespacesStack Overflow
版权声明:本文标题:javascript - JSDoc: What is a relationship between modules and namespaces - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741964946a2407493.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论