Documenting a revealing prototype module

75 views
Skip to first unread message

Jonathan Creamer

unread,
Feb 10, 2012, 3:30:06 PM2/10/12
to jsdoc...@googlegroups.com
How would one go about documenting a function like this...

/** @namespace NS */
var NS = {};

NS.MyClass = (function(){
    function MyClass() {}
    
    var doSomethingPublic = function(){
        doSomethingPrivate();
    };
    
    var doSomethingPrivate = function(){
        console.log('Private!');
    };

    MyClass.prototype = {
        doSomethingPublic: doSomethingPublic
    };

    return MyClass;
}());

Thanks for the help!

Oriol López Sánchez

unread,
Feb 13, 2012, 1:32:12 AM2/13/12
to jsdoc...@googlegroups.com
I would do something like this (although, I am not entirely sure if it's correct, but when I execute jsdoc, it renders the documentation correctly):

/** @namespace NS */
var NS = {};

/**
 * Description of MyClass
 *
 * @class
 * @name NS.MyClass
 */
NS.MyClass = (function(){
    function MyClass() {}
    
    /**
     * My gosh, it's doing something public.
     *
     * @function NS.MyClass#doSomethingPublic
     */

Izzy

unread,
Feb 24, 2012, 4:26:47 PM2/24/12
to JSDoc Users
Check out http://code.google.com/p/jsdoc-toolkit/wiki/TagExports

On Feb 10, 3:30 pm, Jonathan Creamer <matrixhasyou...@gmail.com>
wrote:
Reply all
Reply to author
Forward
0 new messages