After playing around with various things for about four hours yesterday, I think I've figured out the optimal format, which combines nice efficent form while allowing for minimal comments to get things to parse properly.
"use strict";
/** @namespace */
var NS = NS || {};
/** @namespace */
NS.Sub = NS.Sub || {};
/**
* @class
*/
NS.Sub.SomeClass = (function(NS) {
/**
* @constructor
* @lends NS.Sub.SomeClass
*/
var SomeClass = function() {
/** @method */
this.someFunc = function(cookie) {
};
Object.defineProperties(this, /** @lends NS.Sub.SomeClass */ {
/**
* @type {number}
* @instance
*/
somePublicProp: {
getter: function() { return this._somePublicProp || 24; },
setter: function(val) { this._somePublicProp = val; }
}
});
};
return SomeClass;
})(NS);
If anyone has any recommendations on how to make this better, I'd love to hear them. In particular, I can't figure out a way to get rid of the need for var SomeClass; ... return SomeClass
. I'd like to just return it directly (preferably without any name), but then JSDoc loses track of my method, which means more comments, which isn't cool.