-
Notifications
You must be signed in to change notification settings - Fork 240
@property
Synopsis:
@property
Documentation for the property.
@property name
Documentation for the property.
@property {Type} name
Documentation for the property.
@property {Type} [name="default value"]
Documentation for the property.
@property {Type} name.subproperty
Documentation for the subproperty.
Documents the property.
Example:
/**
* @property {Boolean} [hidden=false]
* True when panel is hidden.
*/
Anything that isn't found to be a class, method, event or config, is treated as property. So often the @property
tag is not even needed as it's the default. The following is equivalent of the above:
/**
* True when panel is hidden.
*/
Ext.Panel.prototype.hidden = false;
Here the name (hidden
), type (Boolean
) and default value (false
) of the property are all auto-detected.
Here we use the @property
tag to force JSDuck to treat BASE_URL
as a property (otherwise it will think it is a class name becase it begins with an uppercase letter):
/**
* @property
* Base URL to use for Ajax requests.
*/
Ext.Ajax.BASE_URL = "/";
JsDuck will auto-detect Number, String, Boolean, RegExp and Function types when it sees the corresponding literal assigned to the property. Also arrays of these literals will also detected:
/**
* CSS class names to apply for root element.
*/
cls: ["x-component", "x-item"],
Here the cls
property will be detected with type String[]
.
With anything else the type will default to Object
.
All the above also applies for detecting default values. To avoid auto-detection of default value specify undefined
as the default:
/**
* @property {String} [baseName=undefined]
*/
baseName: "foo",