-
Notifications
You must be signed in to change notification settings - Fork 0
@method
Synopsis:
@method
Documentation for the method.
@method name
Documentation for the method.
Documents the name of the method; or leaves the name for auto-detection and forces the documented entity to be treated as a method.
Example:
/**
* @method area
* Returns area of a circle
* @param {Number} r Radius of the circle.
* @return {Number} The area
*/
See @param and @return for further details on these most commonly used tags inside method documentation.
This tag is auto-detected when doc-comment is right above function declaration. The following code is equivalent of the above one:
/**
* Returns area of a circle
* @param {Number} r Radius of the circle.
* @return {Number} The area
*/
function area(r) {
}
Assignment of function literal works as well:
/**
* Returns area of a circle
*/
var area = function(r) {
}
As does the use inside object literal:
{
/**
* Returns area of a circle
*/
area: function(r) {
}
}
JSDuck also understands Ext.emptyFn and treats the following as a method documentation:
/**
* Returns area of a circle
*/
MyClass.prototype.area = Ext.emptyFn;
That's pretty much all. For example the following code would not be detected as a method if we weren't using the @method
tag. JSDuck does however detect the name:
/**
* @method
* Iterates over items in array.
*/
Array.forEach = (function() {
if (Array.prototype.forEach) {
return Array.prototype.forEach;
}
else {
return function() { ... };
}
})();
Sometimes a method is provided as a hook for extending the functionality of the class. Such methods should be marked with @template (this tag usually goes along with @protected):
/**
* called when this Component's DOM structure is created.
* @template
* @protected
*/
onRender: function() {
}