Skip to content

Instantly share code, notes, and snippets.

@junosuarez
Created April 5, 2013 06:19
Show Gist options
  • Save junosuarez/5317051 to your computer and use it in GitHub Desktop.
Save junosuarez/5317051 to your computer and use it in GitHub Desktop.
JSDoc vs jsig - callbacks
// from http://usejsdoc.org/tags-callback.html
//// Documenting a class-specific callback
/**
* @class
*/
function Requester() {}
/**
* Send a request.
* @param {Requester~requestCallback} cb - The callback that handles the response.
*/
Requester.prototype.send = function(cb) {
// code
};
/**
* This callback is displayed as part of the Requester class.
* @callback Requester~requestCallback
* @param {number} responseCode
* @param {string} responseMessage
*/
//// Documenting a class-specific callback
function Requester() {}
// Send a request.
// cb: (Number, String) => void
Requester.prototype.send = function(cb) {
// code
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment