We're using JSDOC to document our client-facing SDK and we're having difficult getting it to recognize our 'enums' (i.e. constants). Which tags should we use to get JSDOC to pick it up in the documentation? Here's a sample:
/**
* @module Enum
*/
export namespace {
/**
* @enum WidgetType {string}
*/
Enum.WidgetType = {
/** Dashboard */
Dashboard: 'dashboard',
/** Form */
Form: 'entityeditform',
/** Report */
Report: 'report'
};
}
Here's how the 'enums' are used in code:
app.widget({ id: 'account_entityform', type: Enum.WidgetType.Form }).add();
How can we document this with JSDOC?
We're using JSDOC to document our client-facing SDK and we're having difficult getting it to recognize our 'enums' (i.e. constants). Which tags should we use to get JSDOC to pick it up in the documentation? Here's a sample:
/**
* @module Enum
*/
export namespace {
/**
* @enum WidgetType {string}
*/
Enum.WidgetType = {
/** Dashboard */
Dashboard: 'dashboard',
/** Form */
Form: 'entityeditform',
/** Report */
Report: 'report'
};
}
Here's how the 'enums' are used in code:
app.widget({ id: 'account_entityform', type: Enum.WidgetType.Form }).add();
How can we document this with JSDOC?
Share Improve this question edited Apr 8, 2016 at 1:24 A2MetalCore asked Apr 7, 2016 at 22:57 A2MetalCoreA2MetalCore 1,6394 gold badges27 silver badges50 bronze badges2 Answers
Reset to default 6I see that there are ments to this old post asking for more clarification. I just figured it out from the above and can share, as an example, what I came up with. People landing on this page searching for the same thing might find this useful.
/**
* The color of a piece or square.
* @readonly
* @enum {number}
* @property {number} WHITE color for a white square or piece.
* @property {number} BLACK color for a black square or piece.
*/
export const Color = { WHITE: 0, BLACK: 1 }
/**
* Each member is an enumeration of direction offsets used to index into the
* lists of horzontal, vertical, and diagonal squares radiating from a
* given Square object. Only useful internally for initialization or externally
* for test.
* @package
* @type {object}
* @readonly
* @property {enum} Cross an enumeration of vert and horiz directions.
* @property {number} Cross.NORTH north
* @property {number} Cross.EAST east
* @property {number} Cross.SOUTH south
* @property {number} Cross.WEST west
* @property {enum} Diagonal an enumeration of diagonal directions.
* @property {number} Diagonal.NORTHEAST northeast
* @property {number} Diagonal.SOUTHEAST southeast
* @property {number} Diagonal.SOUTHWEST southwest
* @property {number} Diagonal.NORTHWEST northwest
*/
const Direction = {
Cross: {
NORTH: 0, EAST: 1, SOUTH: 2, WEST: 3
},
Diagonal: {
NORTHEAST: 0, SOUTHEAST: 1, SOUTHWEST: 2, NORTHWEST: 3
},
}
After reviewing this article on StackOverflow I was able to get this working using the following:
/**
* @typedef FieldType
* @property {string} Text "text"
* @property {string} Date "date"
* @property {string} DateTime "datetime"
* @property {string} Number "number"
* @property {string} Currency "currency"
* @property {string} CheckBox "checkbox"
* @property {string} ComboBox "bobox"
* @property {string} Dropdownlist "dropdownlist"
* @property {string} Label "label"
* @property {string} TextArea "textarea"
* @property {string} JsonEditor "jsoneditor"
* @property {string} NoteEditor "noteeditor"
* @property {string} ScriptEditor "scripteditor"
* @property {string} SqlEditor "sqleditor"
*/
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1743756636a4501874.html
评论列表(0条)