[英]How to document an “object” parameter of a method
我正在尝试使用YUIDoc为JavaScript方法编写一些文档。 看起来像:
/**
Returns an instance of className
@method getInstance
@param {string} className the of the class used to create the instance
@param {Object} options these are options used to create the instance
**/
function getInstance(className, options) { ..... }
现在,options对象可以有几个参数,比如options.id
, options.single
等。
如何将此信息添加到此@param
的文档中?
参考:http: //yui.github.com/yuidoc/syntax/index.html
“如示例所示,您还可以嵌套@param标记。这使您可以记录具有自己特定嵌套结构的对象参数。”
@param {Object} [options] Data
to be mixed into the event
facade of the `change`
event(s) for these attributes.
@param {Boolean} [options.silent]
If `true`, no `change` event
will be fired.
在YUIDOC 0.3.45中,这是编写本文时的当前版本,为了描述通过方法接收的对象,您应首先声明对象( 选项 ,在下面的示例中),然后使用点符号表示它的属性(例如, options.url )。
/**
* Describe your method
*
* @method yourMethodName
* @param {object} options - These are the options you may pass
* @param {string} options.url - the url
* @param {string} options.otherOption - description of other option
*/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.