JSDoc3 with Dojo and AMD -
i trying js documentation right. using dojo, , other complicated framework built on top of it, spare details. point framework using amd modules. want jsdoc work.
here have far:
/** * creates button instance launches document entry template selector * @module widgets/instance/addbutton */ define([ "dijit/_templatedmixin", "dijit/_widgetbase", "dojo/_base/declare", "dojo/_base/lang", "dojo/on", "kwcn/services/request", "kwcn/widgets/addcontentdialog" ], function (_templatedmixin, _widgetbase, declare, lang, on, request, addcontentdialog) { homecoming declare('addbutton', [_widgetbase, _templatedmixin], /** @lends module:widgets/instance/addbutton */{ id: 'add-button', contentlist: null, templatestring: '<button class="btn btn-link toolbar-link"><i class="fa fa-lg fa-file"></i> add together document</button>', addcontentitem: null, type: null, /** * @constructs * @param args * @param args.type {string} type of content item * @param args.contentlist {contentlist} instance of [contentlist]{@link module:widgets/contentlist/contentlist} in scope */ constructor: function (args) { declare.safemixin(this, args); }, /** * @private */ postcreate: function () { console.log("creating add together content button..."); this.addcontentitem = new addcontentdialog({ repository: request.repository(), hascase: false }); this.own(on(this.domnode, 'click', lang.hitch(this, 'show'))); }, /** * @public */ show: function () { request.inboundfolder().then(lang.hitch(this, function (folder) { this.addcontentitem.showadddocument(null, folder); })); } }); }); the result:
this result not bad. infers members static. webstorm seem infer them correctly members, jsdoc3 generator not. read, should not have specify @memberof @lends should taking care of that. there doing wrong? general recommendation appreciated. read jsdoc3 documentation, lot of constructs seem blurry when adding amd equation.
you need lend instance properties prototype, not object itself: @lends module:widgets/instance/addbutton#. note # @ end, shorthand .prototype.
also note jsdoc3 has had quite few bugs related handling of non-commonjs modules, may need hacky stuff create work correctly.
dojo amd jsdoc3
No comments:
Post a Comment