简体   繁体   English

AMD + Backbone + JSDoc3文档的最佳方式

[英]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. 我需要生成一个清晰的文档,其中ProductProducts类出现在模型/产品模块中,但我清楚地看到了模块,并且单独了。

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. PD1:我真的读过其他帖子,我不是想重复问题。

PD2: Sorry my poor english :S PD2:对不起,我的英语很差:S

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. 我明白,既然你已经在匿名函数中编写了@module ,那么它就会被忽略。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM