Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AMD + Backbone + JSDoc3 best way to document

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

like image 669
Exos Avatar asked Nov 06 '15 10:11

Exos


1 Answers

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.

like image 109
Vijay Dev Avatar answered Oct 02 '22 15:10

Vijay Dev