質問

I am using John Resig's Class extend to build a set of components, and I am using JsDoc to create the documentation for them. When I create a "class" like this:

/**
 * Tests a thing to see what it is, baby
 * @param {string=}Id the Id babyyyy
 * @constructor
 */
TestThing = function(Id){
    /**
     * The thing's id
     * @type {string=}
     */
    this.Id = Id;
}

/**
 * Gets the thing
 * @param {number} id
 * @returns {number}
 * @memberof TestThing
 */
TestThing.prototype.Get = function(id){
    return 5;
}

JsDoc works as expected, creates a class in the documentation.

When I create one using John's extend:

/**
 * Tests a thing to see what it is, baby
 * @constructor
  */
 TestThing2 = Class.extend({

     /**
      * Creates another thing
      * @constructs TestThing2
      * @param {number} id
      */
     init: function(id) {
         /**
          * The thing's id
          * @type {string=}
          */
         this.Id = id;
     },

     /**
      * Gets the thing
      * @param {number} id
      * @returns {number}
      * @memberof TestThing2
      */
     Get: function(id) {
         return 5
     }
 })

I get documentation with 2 versions of the class on the same page, the first one without the constructor arguments (so new TestThing2()) and the second with the arguments (new TestThing2(id)).

Obviously I don't want two versions of documentation, especially when the first is "wrong". I'm guessing I'm missing some tag or something, but I can't figure out what.

Thanks in advance.

役に立ちましたか?

解決

If you remove the first doclet in your second example, you'll get only one class in the documentation, with links and docs pointing to the right place.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top