如何使用JSDoc3记录AMD + Backbone项目

时间:2013-03-01 20:30:43

标签: backbone.js requirejs amd jsdoc

我有一个基于Backbone boilerplate的项目,我希望用最近的jdoc-toolkit

进行记录

虽然我无法生成除空_global类

之外的任何内容

代码示例:

/**
 * This is a root model for DLClass
 * @module models/DLClass
 */
define([
    'underscore',
    'backbone'
], /** @lends DLClass */ function (_, Backbone) {        
    /**
     * This is a root model for DLClass
     * @class DLClass
     * @constructor
     * @return Session Object
     */
    var DLModel = Backbone.Model.extend({
        /** @lends DLClass.prototype */

    /**
     * Generic tap event
     * @param touchEvent
     */
    onTap: function (touchEvent) {

    },

1 个答案:

答案 0 :(得分:3)

尝试添加@namespace以让JSDoc知道查看模块的内容。并使用@name定义您的模块及其功能。

/** 
 * This is a root model for DLClass
 * @module models/DLClass
 * @namespace
 */
define([
    'underscore',
    'backbone'
], /** @lends DLClass */ function (_, Backbone) {        
    /**
     * This is a root model for DLClass
     * @class DLClass
     * @module models/DLClass
     * @name DLClass
     * @constructor
     * @return Session Object
     */
    var DLModel = Backbone.Model.extend({
        /** @lends DLClass.prototype */

        /**
         * Generic tap event
         * @name DLClass.onTap
         * @function
         * @param touchEvent
         */
        onTap: function (touchEvent) {

        },