I'm looking for a way to document functions contained in a Dictionary in Javascript with JSDoc 3.
Even though I tell JSDoc there is a function with @function
, it is not included in the generated documentation.
Is there a JSDoc tag that could help? Or is there a more convenient approach than mine?
Thanks
/**
* @namespace Minitel
*/
var Minitel = Minitel || {}
/**
* @callback actionCallback
* @param {Stream} stream The Minitel Stream to which add the Videotex codes
* @param {Object} data Data object
* @param {?number} offsetX X offset
* @param {?number} offsetY Y offset
*/
/**
* Action callbacks
* @member {Object.<string, actionCallback>}
*/
Minitel.actions = {}
/**
* Handles "content-string" actions. The value should already be ready to be
* sent in the stream.
* @function
*/
Minitel.actions["content-string"] = function(stream, data) {
/* ... */
}
/**
* Handles "content-block" actions. It only supports left, center and right
* alignment.
* @function
*/
Minitel.actions["content-block"] = function(stream, data, offsetX, offsetY) {
/* ... */
}
I'm using jsdoc -p -c jsdoc.json app/*.js library/minitel/*.js
to generate the documentation
Here is jsdoc.json
:
{
"plugins": ["plugins/markdown"],
"opts": {
"template": "../docdash"
}
}
I am not sure (as jsdoc is not verbose sometimes) but it looks like @member
can not have children. A solution can be to use @namespace
.
So your actions
will be documented as follows:
/**
* Action callbacks
* @namespace
*/
One issue with @namespace
is that you cannot define a type for it. But in this case all methods are documented even without @function
as static ones.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.