I have a large, well-structured JavaScript object that looks something like this:
var MyClass = (function(window, document, $) {
return function(options) {
"use strict";
var
x = 123,
myFunc = function() { },
otherFunc = function() { };
return {
myFunc: myFunc
};
};
})(window, document, window.jQuery);
Essentially, outer closure is used to control the global scope visible by the inner closure, which implements the form of the module template: the inner function is actually a constructor, and its nested functions are efficient methods, and the returned object is actually a list of which parts of it are “public” .
JSDoc hates this.
(For recording, I use JSDoc 3.4.)
@lend @export @namespace @memberof , , , JSDoc - - " "; .
JavaScript, , , . JavaScript : .
JSDoc , JSDoc , , . StackOverflow , jane JavaScript, .
- JSDoc MyClass "class", "" ""? otherFunc @private -, , myFunc @public -, , , , JSDoc , .