Lea Hayes
Lea Hayes

Reputation: 64196

How to document namespaces in JavaScript?

How can namespaces be documented in JavaScript with jsDoc?

Here is my attempt, is this right?

/**
 * My special namespace
 *
 * @name my.namespace
 * @namespace
 */
$namespace('my.namespace', /** @lends my.namespace **/ {
    /**
     * Foo - does something really neat...
     * @function
     */
    foo: function() {
    }
});

Just to clarify, the above is used as follows:

my.namespace.foo();

Upvotes: 6

Views: 4436

Answers (1)

Lea Hayes
Lea Hayes

Reputation: 64196

This feature is available in jsdoc3 micmath/jsdoc. The syntax of jsdoc3 is different to jsdoc-toolkit (jsdoc2)

The following example was by Michael jsdoc and pseudo-namespaces?

/**
* Document me.
* @namespace my
*/

/**
* My special namespace
* @namespace my.namespace
*/
$namespace('my.namespace', /** @lends my.namespace **/ {
   /**
    * Foo - does something really neat...
    */
   foo: function() {
   }
});

Upvotes: 8

Related Questions