I'm trying to document my program with the JSDoc syntax for myself and the people that will have to look at my code. I'm also trying to improve my skills.
For a parameter of the jQuery type, I'm a little puzzled. I know that's an object, but it's fairly common in my program, so I think I should first declare a typedef for the jQuery type, then use it as my parameter type. So I ask, would it be the correct way to do it?
/**
* DOM object referenced by jQuery
* @typedef {jQuery} $jQueryDomObject
*/
/**
* SOAP call that does ...
*
* @param {string} code Some desc ...
* @param {callback} fnctVa Some desc ...
* @param {$jQueryDomObject} $attrib Input field that ...
*/
myfunction = function (code, fnctVa, $attrib) {};
I also found on SO this question, somewhat similar:
How can I get JSDoc to mark my param as a jQuery object?
For a parameter that is a jQuery object, I often just do:
@param {jQuery} foo
And do not further define what jQuery is. It is known well enough. However, if you want, you can do this with jsdoc 3:
/**
* jQuery object
* @external jQuery
* @see {@link http://api.jquery.com/jQuery/}
*/
/**
* SOAP call that does ...
*
* @param {string} code Some desc ...
* @param {callback} fnctVa Some desc ...
* @param {external:jQuery} $attrib Input field that ...
*/
var myfunction = function (code, fnctVa, $attrib) {};