swallowzhang / jsdoc-toolkit

Automatically exported from code.google.com/p/jsdoc-toolkit
0 stars 0 forks source link

Document a return value that depends on a function parameter (Factory method) #315

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I have been looking for a way to document a return value that depends on a 
function parameter value. Here is an example:

/**
 * Creates a new instance of type, dynamically loads the source files via AJAX if needed.
 *
 * @param {String} type
 * @return type
 */
function create(type) {
    // Load it via AJAX if it is not defined...
    return new window[type];
}

As far as I know, there is no official documentation that describes a way to do 
this. A support for this kind of functionality would be extremely useful. Could 
we get this in JsDoc toolkit version 3?

Original issue reported on code.google.com by kaisellgren@gmail.com on 6 Feb 2011 at 11:26