AMD + Backbone + JSDoc3 best way to document
Asked Answered
N

1

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

Nepenthe answered 6/11, 2015 at 10:42 Comment(2)
This way of asking for recommending tools and ways is considered off-topic on this site. Look: stackoverflow.com/help/on-topicBingaman
"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.Nepenthe
C
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.

Claman answered 18/11, 2015 at 5:19 Comment(2)
Can anyone verify if this is the issue. The main author is away I guess.Claman
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.Nepenthe

© 2022 - 2024 — McMap. All rights reserved.