To answer my own question:
At least the first part was easier than I thought:
define(function () {
/**
* @exports C
*/
var C = function () { // constructor }
C.prototype = /** @lends module:C */ {
someStaticVar: "value",
someMethod: function () { … }
}
return new C();
}
Now the docs look like I want them to, so that the module "C" appears as a single instance (not to be invoked with "new").
But now, if I have a similar module "D" that should inherit from "C", this does not work.
I write "D" like "C":
define(function () {
/**
* @exports D
* extends module:C
*/
var D = function () { // constructor }
D.prototype = /** @lends module:D */ {
someOtherStaticVar: "value",
someOtherMethod: function () { … }
}
return new D();
}The methods and member from module "C" simply do not show. How would I do this then?