【发布时间】:2013-10-01 10:14:03
【问题描述】:
我正在尝试自动化我们的 JS 库中的一个特定模块,并且卡在我想要定义一组属性的点上(比如说一个作为类的构造参数的对象)。
/**
* This function initiates world peace!
* @constructor
* @param {object} defaults - The options to initiate peace.
* @param {number} defaults.issues - The number of issues being taken up.
* @param {string} defaults.source - The name of the location where process starts.
*/
var WorldPeace = function (defaults) {
// code here
};
如果建筑的所有属性都在一个位置定义,那就太好了。不幸的是,我的代码有许多模块有助于构建属性。比方说,在代码的其他部分(在以后的文件中)导致有几个属性
* @param {Date} defaults.start - The date when the process started.
* @param {Date} defaults.stop - The date when the process should stop.
如何添加到我之前为WorldPeace 函数定义的原始属性集?做一些类似 mixin 或子类化属性的事情会过火!因此,如果我可以简单地注入到属性列表定义中,那就太好了。
【问题讨论】:
标签: javascript google-closure-compiler google-closure jsdoc code-documentation