【发布时间】:2014-05-30 12:44:40
【问题描述】:
JSDoc 3 的documentation 包含此示例:
/**
* The complete Triforce, or one or more components of the Triforce.
* @typedef {Object} WishGranter~Triforce
* @property {boolean} hasCourage - Indicates whether the Courage component is present.
* @property {boolean} hasPower - Indicates whether the Power component is present.
* @property {boolean} hasWisdom - Indicates whether the Wisdom component is present.
*/
/**
* A class for granting wishes, powered by the Triforce.
* @class
* @param {...WishGranter~Triforce} triforce - One to three {@link WishGranter~Triforce} objects
* containing all three components of the Triforce.
*/
function WishGranter() {}
我实际上是在创建一个类,该类接受一个实现接口MessageQueueConnector 的对象,该接口应该实现一个方法connectAndSubscribe。由于 Javascript 不区分成员函数和成员变量,所以使用属性是有意义的,而 JSDoc 的文档暗示 @method 是无关的。但是,方法听起来更正确,所以我想知道这是否是首选,或者我是否只是做错了所有这些(即,如果有一种更简单的方法首先记录这种情况,而无需创建类型)。
【问题讨论】:
标签: javascript jsdoc jsdoc3