Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can use a combination of <a href="http://usejsdoc.org/howto-commonjs-modules.html" rel="noreferrer">@module</a> or <a href="http://usejsdoc.org/tags-namespace.html" rel="noreferrer">@namespace</a> along with <a href="http://usejsdoc.org/tags-memberof.html" rel="noreferrer">@memberof</a>.</p> <pre><code>define([], function() { /** * A test module foo * @version 1.0 * @exports mystuff/foo * @namespace foo */ var foo = { /** * A method in first level, just for test * @memberof foo * @method testFirstLvl */ testFirstLvl: function(msg) {}, /** * Test child object with child namespace * @memberof foo * @type {object} * @namespace foo.bar */ bar: { /** * A Test Inner method in child namespace * @memberof foo.bar * @method baz */ baz: function() { /*...*/ } }, /** * Test child object without namespace * @memberof foo * @type {object} * @property {method} baz2 A child method as property defination */ bar2: { /** * A Test Inner method * @memberof foo.bar2 * @method baz2 */ baz2: function() { /*...*/ } }, /** * Test child object with namespace and property def. * @memberof foo * @type {object} * @namespace foo.bar3 * @property {method} baz3 A child method as property defination */ bar3: { /** * A Test Inner method in child namespace * @memberof foo.bar3 * @method baz3 */ baz3: function() { /*...*/ } }, /** * Test child object * @memberof foo * @type {object} * @property {method} baz4 A child method */ bar4: { /** * The @alias and @memberof! tags force JSDoc to document the * property as `bar4.baz4` (rather than `baz4`) and to be a member of * `Data#`. You can link to the property as {@link foo#bar4.baz4}. * @alias bar4.baz4 * @memberof! foo# * @method bar4.baz4 */ baz4: function() { /*...*/ } } }; return foo; }); </code></pre> <p><strong>EDIT as per Comment:</strong> (Single page solution for module)</p> <p>bar4 without that ugly property table. ie @property removed from bar4.</p> <pre><code>define([], function() { /** * A test module foo * @version 1.0 * @exports mystuff/foo * @namespace foo */ var foo = { /** * A method in first level, just for test * @memberof foo * @method testFirstLvl */ testFirstLvl: function(msg) {}, /** * Test child object * @memberof foo * @type {object} */ bar4: { /** * The @alias and @memberof! tags force JSDoc to document the * property as `bar4.baz4` (rather than `baz4`) and to be a member of * `Data#`. You can link to the property as {@link foo#bar4.baz4}. * @alias bar4.baz4 * @memberof! foo# * @method bar4.baz4 */ baz4: function() { /*...*/ }, /** * @memberof! for a memeber * @alias bar4.test * @memberof! foo# * @member bar4.test */ test : true } }; return foo; }); </code></pre> <p>References -</p> <ol> <li><a href="https://stackoverflow.com/questions/17119100/how-to-use-jsdoc3-to-document-nested-namespaces">Another Question about nested namespaces</a></li> <li><a href="http://leahayes.wordpress.com/2011/08/28/documenting-javascript-with-jsdoc3/" rel="noreferrer">For alternative way of using Namespaces</a></li> <li><a href="https://groups.google.com/forum/#!topic/jsdoc-users/izErstbwNUU" rel="noreferrer">Documenting literal objects</a></li> </ol> <p><strong>*Note</strong> I haven't tried it myself. Please try and share the results.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload