8
有沒有辦法避免必須爲@property和@param輸入兩個單獨的行,如果在構造函數中參數和屬性是同名。JSDoc工具包 - 如何在同一行上指定@param和@property
/**
* Class for representing a point in 2D space.
* @property {number} x The x coordinate of this point.
* @property {number} y The y coordinate of this point.
* @constructor
* @param {number} x The x coordinate of this point.
* @param {number} y The y coordinate of this point.
* @return {Point} A new Point
*/
Point = function (x, y)
{
this.x = x;
this.y = y;
}
我的建議是,你只需要從構造函數中聲明jsdoc屬性(即使它只是稍後分配),避免從類中的隨機函數中創建它們。 –