How to use JSDocParser with the Module pattern and define/require

Just a quick example:


/** @namespace MyNamespace */
define("MyNamespace", "Anotherone", function () {
    /**
    * @scope MyNamespace.Obj
    * @constructor
    * */ 
    function Obj() {
        var that = {};
        /** 
        * @memberOf MyNamespace.Obj#
        * @type Array
        */
        that.somearray = new Array();
        return that;
    }
    return Obj();
});

In the IDE you can use require with the generated output code of JSDocParser (even in another file):

 

/** @type MyNamespace.Obj */
var tmp = require("MyNamespace");

// tmp will now have autocomplete

Last edited Jan 13, 2012 at 2:09 PM by WalaWala, version 4

Comments

No comments yet.