2

We're using jsdoc for a very javascript-heavy project. In order to get code-documentation we let jsdoc build html-files via grunt.

So far we successfully assigned properties and methods to modules using the "memberof" keyword like this:

Example

/**
 * Short description of this module
 *
 *
 * @module hse-catalog
 */
jQuery(document).ready(function($) {
    'use strict';

    /**
     * @namespace catalog
     * @memberof module:hse-catalog
     */
    catalog = {

        selector: {
            /* Stuff in here */
        },

        /**
         * Initializes the module.
         *
         * @memberof module:hse-catalog
         */
        init: function() {
            // do init
        },

        /**
         * Indicates whether the module is ready to load.
         *
         * @return {boolean} true or false
         * @memberof module:hse-catalog
         */
        isReady: function() {
            // do stuff
        }

        /**
         * Initializes the catalog page breadcrumb.
         * @deprecated out of order
         * @memberof module:hse-catalog
         */
        initBreadcrumb: function() {
            // do stuff
        }
    };
});

This creates us a very nice html-documentation which lists all modules. If I click on one of these modules there, I see all properties and methods of this modules. So far so good.

But the real problem is that we also want modules to be assigned to certain namespaces. How do we do that? Does jsdoc support this at all?

Timo Ernst
  • 15,243
  • 23
  • 104
  • 165
  • Do you want your modules to actually appear in something called a "Namespace" in the jsdoc documentation? If yes, I'm thinking this is probably not doable. If you'd be satisfied with something which is not a "Namespace", then it would help if you could specify in your question what you'd like the documentation to do for you. (I'm asking the latter because I use jsdoc for an app that has over 50 modules organized in a hierarchy. I don't use namespaces but what I'm doing may not satisfy your requirements.) – Louis May 28 '14 at 11:57
  • @Louis I want a similar relation between modules and namespaces like in Java between classes and packages. – Timo Ernst May 28 '14 at 13:06
  • 2
    It seems to me you're thinking of jsdoc's namespaces as analogous to Java's packages and jsdoc's modules as analogous to Java's classes. Really, jsdoc's modules are the analogue to the Java packages, and a module can contain one or more classes. – Louis May 28 '14 at 16:52
  • @Louis Ahhh! Now I get it! Thanks mate, that solves things up. – Timo Ernst Jun 02 '14 at 11:31
  • 1
    @Louis, please add an answer ;-) Thank you! – Alex Yaroshevich Jun 16 '15 at 14:10

0 Answers0