跨多个方法记录相同的jsduck配置类型
Documenting the same jsduck config type across multiple methods
两个问题:
首先,有人知道如何继承一些文档的一部分吗?特别针对"options"对象:
* @param {Object} opts
* @param {String} opts.effect Transition effect. fade|slide
* @param {String} opts.direction Direction to do the transition, when applicable. up|down|left|right
* @param {String|Number} opts.duration Transition duration in ms, or one of short|long
* @param {String|Function} opts.timing Transition timing function, or one of
基本上,我希望文档在多个方法中,但我不想把它复制到每个方法中,我想要一个公共的地方来修改它。
第二,如果我能以某种方式继承文档,我能扩展它吗?例:我想:method foo:
opts.opt-a // inherited
opts.opt-b // inherited
opts.opt-c // inherited
opts.opt-d // local to this method
不支持这种继承。
你可以做的是,将这个options对象记录为一个文档类:
/**
* @class FooOpts
* A configuration object for Foo, instantiated with object literal.
*/
/** @cfg {String} effect */
/** @cfg {String} direction */
/** @cfg {String|Number} duration */
/** @cfg {String|Function} timing */
然后使用这个document -only-class作为参数类型:
* @param {FooOpts} opts Config object for the FooOpts class.
要覆盖这些选项,可以定义一个子类。
根据您拥有的选项的数量,这种方法的开销可能不合理。但是,如果您在几个地方指定了相同的选项,这可能表明您最好为它们创建一个实际的具体类。
相关文章:
- RequireJS向模块传递配置总是返回undefined
- 如何配置分析以将数据发送到我自己的服务器
- 扩展jQuery插件以更改配置
- webRTC错误未定义配置
- 如何配置WebStorm以正确格式化生成器函数
- Javascript配置服务器URL并将其存储
- Node Red在Admin UI中获取配置节点值
- AngularJS智能表全局配置实现
- react路由器使用简单的javascript路由器配置来处理不匹配的路径
- web配置http到https重定向异常
- 如何配置browserfy与Karma使用转换Stringify为Mustache模板
- 将任何CDN配置为只传递一个文件,无论请求的url是什么
- 使用javascript配置文件作为handlebas博客模板,但配置不是't工作正常
- 我可以访问量角器配置文件中的参数吗
- 如何使用socket.io在meanjs项目中配置jshint
- Django无法通过urls.py配置找到djangular/app.js文件.如何进行故障排除
- 命名和配置jsfiddle
- 如何从配置文件中设置Angular值
- 如何使console.log可配置
- 跨多个方法记录相同的jsduck配置类型