Skip to content

Instantly share code, notes, and snippets.

@Nico-Duduf
Last active February 9, 2018 09:16
Show Gist options
  • Save Nico-Duduf/0fe0f4155484680b7d9f1e04f6b4aa4b to your computer and use it in GitHub Desktop.
Save Nico-Duduf/0fe0f4155484680b7d9f1e04f6b4aa4b to your computer and use it in GitHub Desktop.
How to JSDoc object (like typedef) with property, method and callback function.
/**
* @class
* @name TheTypeName
* @classdesc The description of the type.<br />
* This is not a real class, and cannot be instanciated.<br />
* Use {@link methodWhichReturnsThisType} to create a TypeName.<br />
* TypeName inherits Type and has all of its properties and methods.
* @property {string} aProperty - This is a string property
* @property {TheTypeName~callBack} callBack - a callback. You can set this to one of your own function.
*/
/**
* The function to execute on the class.
* @callback TheTypeName~callBack
* @memberof TheTypeName
*/
/**
* A method which does something
* @method
* @memberof TheTypeName
* @name theMethod
* @param {string} text - a parameter of the method
* @return string - Something is returned by the method
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment