Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Callback tag/type #33

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

Callback tag/type #33

spocke opened this issue May 28, 2012 · 5 comments

Comments

@spocke
Copy link
Contributor

spocke commented May 28, 2012

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.
 */
@ghost ghost assigned davglass May 29, 2012
@spocke spocke mentioned this issue May 30, 2012
@gagle
Copy link

gagle commented Oct 28, 2012

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");

@wbyoung
Copy link

wbyoung commented Aug 27, 2014

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

@visionscaper
Copy link

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
Copy link
Member

okuryu commented Jan 16, 2015

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

@visionscaper
Copy link

@okuryu :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants