9

I'm looking for the best way to document my code, but I don't find anything.

I've see others topics, including this, but there all doesn't resolve my problem.

I have something like this:

define([
    'backbone'
], function (Backbone) {

    /**
     * @module models/products
     */

    /**
     * Product model
     * @class
     */
    var Product = Backbone.Model.extend({
        /** @lends Product.prototype */

        /**
         * Some method
         * @param {String} name - Name of something
         * @return {something}
         */

         someMethod: function () {
             // ...
         }

    });

    /**
     * Products collection
     * @class
     */
    var Products = Backbone.Collection.extend({
        /** @lends Products.prototype */

        /**
         * @type {Product}
         */
        model: Product,


        /**
         * Some method
         * @param {String} name - Name of something
         * @return {something}
         */

         someMethod: function () {
             // ...
         }

    });

    return Products;

});

I need to generate a legible documentation, where Product and Products classes apears into the models/products module, but I get the module clear and the classes by separate.

I suppose there is someone who has gone through this issue.

Thanks.

PD1: I really read other posts, I'm not trying to duplicate questions.

PD2: Sorry my poor english :S

Community
  • 1
  • 1
Exos
  • 3,610
  • 1
  • 19
  • 28
  • This way of asking for recommending tools and ways is considered off-topic on this site. Look: http://stackoverflow.com/help/on-topic – mico Nov 15 '15 at 19:40
  • "We feel the best Stack Overflow questions have a bit of source code in them, but if your question generally covers…[...] software tools commonly used by programmers; and is", Wy you thinks it's off toppic? I'm asking the correct use of a "commonly used by programmers" tool. I don't asking for a better use, I asking for the correct use. – Exos Nov 18 '15 at 22:02

1 Answers1

1

After reading this doc, I understand that your problem can be solved by moving the following code to the top of the file:

/**
 * @module models/products
 */

I understand that since you have written @module inside a anonymous function its just get ignored.

Vijay Dev
  • 832
  • 5
  • 13
  • Can anyone verify if this is the issue. The main author is away I guess. – Vijay Dev Nov 18 '15 at 13:21
  • 1
    No, if I move the "module" to top of file, I have the module without the class, I tried it (if you check the thread I share in the description), using the "lends" on the factory without results. – Exos Nov 18 '15 at 22:10