2

我有一个遵循这种模式的模块。

/**
 *  @name Filters
 *  @namespace
 */
var Filters = (function (Filters, $) {
    Filters.switchView = function (newView) {
        // do something
    };
    return Filters;
})(Filters || {}, jQuery);

然后我有一个过滤器模块的子模块

Filters.validator = (function (Filters, $) {
    var validator = {};
    validator.toggleErrorState = function (state, el) {
         // do something
    } 
    return validator;
})(Filters || {}, jQuery);

我不知道如何记录子模块。我已经进行了一些搜索,但没有找到任何其他遵循这种使用 jsdoc 样式注释记录的特定模式的人。任何帮助将不胜感激。

4

2 回答 2

0
/**
 *  @namespace Parent
 */
var Filters = (function (Filters, $) {
    /**
     * switchView does...
     * @param newView The new view.
     */
    Filters.switchView = function (newView) {
        // do something
    };
    return Filters;
})(Filters || {}, jQuery);

/**
 * @namespace Child
 * @memberOf Parent
 */
Filters.validator = (function (Filters, $) {
    var validator = {};
    /**
     * toggleErrorState does...
     * @param state The state.
     * @param el The el.
     */
    validator.toggleErrorState = function (state, el) {
         // do something
    }
    return validator;
})(Filters || {}, jQuery);
于 2014-09-19T07:29:11.990 回答
0

这记录了两个名称空间。第一个文件:

/**
 *  @namespace
 */
var Filters = (function (Filters, $) {
    /**
     * switchView does...
     * @param newView The new view.
     */
    Filters.switchView = function (newView) {
        // do something
    };
    return Filters;
})(Filters || {}, jQuery);

第二个文件:

/**
 * @namespace
 */
Filters.validator = (function (Filters, $) {
    var validator = {};
    /**
     * toggleErrorState does...
     * @param state The state.
     * @param el The el.
     */
    validator.toggleErrorState = function (state, el) {
         // do something
    }
    return validator;
})(Filters || {}, jQuery);
于 2013-12-20T11:59:42.073 回答