Callback tag/type #33

Open
spocke opened this Issue May 28, 2012 · 5 comments

6 participants

@spocke

It would be nice to be able to document function callbacks and reference these from functions like this.

/**
 * My function.
 *
 * @method myMethod
 * @param {MyCallback} callback A callback to be executed.
 */

/**
 * A callback.
 *
 * @callback MyCallback
 * @param {String} myString Some string.
 */
@davglass davglass was assigned May 29, 2012
@gagle

I also think this would be nice...

Currently for callback parameters I use helpers that applies the same css:

@param {Function} cb Callback to notify the result.

It receives one parameter:

* error {{#Object}}{{/Object}}  
Error or <code>null</code>.

result: http://image.gxzone.com/images/f/d/fdb05564fe5.png

helpers:

var def = function (type){
    module.exports[type] = function (){
        return "<a target='_blank' class='crosslink external type' style='border-bottom: 1px do" +
                "tted #AFAFAF' onmouseover='this.style.borderBottom = \"\";' onmouseout='this.s" +
                "tyle.borderBottom = \"1px dotted #AFAFAF\";' href='https://developer.mozilla.o" +
                "rg/en/JavaScript/Reference/Global_Objects/" + type + "'>" + type + "</a>";
    };
};

module.exports = {};
def ("Array");
def ("Boolean");
def ("Date");
def ("Function");
def ("Iterator");
def ("Number");
def ("Object");
def ("RegExp");
def ("String");
@neekey neekey referenced this issue in jsdoc3/jsdoc Dec 19, 2012
Closed

Ability to document callback arguments #260

@wbyoung

Other documentation tools that I've used have a typedef type feature that generalizes this.

@visionscaper

I would be very interested in a YUIDoc implementation of typedef as well (JSDoc3 has it). It is cumbersome to specify the same callback definition everywhere you use it over and over again.

@okuryu
YUI Library member

OK, OK. I'd take a look in the near future. All thoughts are appreciated for now.

@okuryu okuryu assigned okuryu and unassigned davglass Jan 22, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment