Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Callback tag/type #33

Open
spocke opened this Issue · 5 comments

6 participants

Johan Sörlin Gabriel Llamas Whitney Young Freddy Snijder Ryuichi Okumura Dav Glass
Johan Sörlin

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.
 */
Dav Glass davglass was assigned
Gabriel Llamas

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
Closed

Ability to document callback arguments #260

Whitney Young

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

Freddy Snijder

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.

Ryuichi Okumura
Collaborator

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

Dav Glass davglass was unassigned by okuryu
Ryuichi Okumura okuryu self-assigned this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.