The following will move the barX
methods where they belong. Note that there's nothing for jsdoc to do with the doclet that documents the IIFE. The key to get the methods in the right place is /** @lends blah.foo# */
. See the documentation of the @lends
. The #
tells jsdoc that the items lent to blah.foo
belong to an instance of the class. See the documentation on namepaths for more details.
/**
* Blah - Our very own global Namespace
* @namespace
* @global
*/
window.blah = window.blah || {};
/**
* Immediately-Invoked Function Expression (IIFE).
* @function
* @param {object} w - Global window object.
* @returns {Object} window.blah.foo
*/
(function (w) {
// strict JS
'use strict';
/**
* Create instance of w.blah.foo constructor
* @constructor
* @name blah.foo
*/
w.blah.foo = function () {
};
/** @lends blah.foo# */
w.blah.foo.prototype = {
/**
* Dummy function to return the number 1.
*/
bar1: function () {
console.log(1);
},
/**
* Dummy function to return the number 2.
*/
bar2: function () {
console.log(2);
},
/**
* Dummy function to return the number 3.
*/
bar3: function () {
console.log(3);
}
};
}(window));