javascript - Describe property defined with Object.defineProperty -
i want add jsdoc documentation property added object.defineproperty
. guess might work:
/** @constructor */ function myclass() { /** @property {number} rnd */ object.defineproperty(this, 'rnd', { : function () { return math.random(); } }); }
but generated jsdoc explanation not have property:
$ jsdoc -x test.js [ { "comment": "/** @constructor */", "meta": { "range": [ 20, 167 ], "filename": "test.js", "lineno": 2, "path": "/jsdoctest", "code": { "id": "astnode100000001", "name": "myclass", "type": "functiondeclaration", "paramnames": [] }, "vars": { "": null } }, "kind": "class", "name": "myclass", "longname": "myclass", "scope": "global" }, { "comment": "", "meta": { "range": [ 116, 159 ], "filename": "test.js", "lineno": 5, "path": "/jsdoctest", "code": { "id": "astnode100000012", "name": "get", "type": "functionexpression", "value": "function" } }, "undocumented": true, "name": "get", "longname": "get", "kind": "function", "scope": "global" }, { "kind": "package", "longname": "package:undefined", "files": [ "/jsdoctest/test.js" ] } ]
what appropriate approach document kind of properties? (plugin maybe?)
this it:
/** @constructor */ function myclass() { /** * @property {number} * @name myclass#rnd */ object.defineproperty(this, 'rnd', { : function () { return math.random(); } }); }
i've used @property {type} name
syntax never inside of class. typically like:
/** @property {object} */ this.foo = {};
and jsdoc uses this.foo
compute name (foo
) , entity belongs to. appears using @property {type} name
in class not work.
if specify name @name
, knows name give , belongs. #
indicates instance variable (rather static or inner). see namepath documentation details.
Comments
Post a Comment