- 
                Notifications
    
You must be signed in to change notification settings  - Fork 152
 
Promises
        fearandesire edited this page Jun 26, 2022 
        ·
        7 revisions
      
    You can use custom tags in Jsdoc2md, for example @bread, @milk, @fulfil, @reject - whatever you like. Custom tags will be rendered as-written in the source comments. There is no standard way to document promises, this is one way to do it using custom tags.
- 
Use
@fulfiland@rejecttags:/** * Returns something. * * @returns {Promise} * @fulfil {string} - The data you wanted. * @reject {Error} - The error `name` property will be one of the following: * * - `NO_THANKS`: Computer doesn't want to. * - `TOO_MUCH`: Too much work, get some other app to do it. */ function getSomething () {} - 
Produces output like this:
 
Returns something.
Kind: global function
Fulfil: string - The data you wanted.
Reject: Error - The error name property will be one of the following:
NO_THANKS: Computer doesn't want to.
TOO_MUCH: Too much work, get some other app to do it.
- Home
 - How jsdoc2md works
 - Additional jsdoc tags supported
 - Cherry picking which documentation appears in output
 - Showcase ...
 - Create ...
 - How To ...
- How to use with npm run
 - How to use with gulp
 - How to create one output file per class
 - How to document a AMD module
 - How to document a CommonJS module (exports)
 - How to document a CommonJS module (module.exports)
 - How to document an ES2015 module (multiple named exports)
 - How to document an ES2015 module (single default export)
 - How to document Promises (using custom tags)
 - How to document a ToDo list
 - How to document ES2017 features
 - How to document TypeScript
 - The @typicalname tag
 - Linking to external resources
 - Param list format options
 - Listing namepaths
 
 - Troubleshooting
 
