javascript 如何让 JSDoc 将我的参数标记为 jQuery 对象?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13610979/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I get JSDoc to mark my param as a jQuery object?
提问by Nick G.
I'm attempting to thoroughly comment my JavaScript and I'm using JSDoc. I have a function that consumes a jQuery object and I'd like to mark the parameter as such.
我正在尝试彻底评论我的 JavaScript,我正在使用 JSDoc。我有一个使用 jQuery 对象的函数,我想将参数标记为这样。
Currently, I have this:
目前,我有这个:
/**
* Initializes a login object.
* @param formEl {JQuery} The login form element on the page.
*/
var login = function(formEl){ ... }
But JSDoc doesn't recognize (or properly format) "JQuery" as a variable type. Any help?
但是 JSDoc 无法识别(或正确格式化)“JQuery”作为变量类型。有什么帮助吗?
回答by OneOfOne
According to http://code.google.com/p/jsdoc-toolkit/wiki/TagParamit should be
根据http://code.google.com/p/jsdoc-toolkit/wiki/TagParam应该是
Param type before param name.
参数名称前的参数类型。
/**
* Initializes a login object.
* @param {jQuery} formEl The login form element on the page.
*/
var login = function(formEl){ ... }