[英]Make JSDoc comment for function which takes another function as parameter
Imagine a function which accepts an "onUpdate" function as a parameter:想象一个接受“onUpdate”函数作为参数的函数:
/**
* @param {function} onUpdate
* @returns {null}
*/
static async init(onUpdate) {
...
onUpdate(true);
};
onUpdate takes a boolean as an argument. onUpdate 将布尔值作为参数。 I want to add that arguments to @param {function} onUpdate
.我想将该参数添加到@param {function} onUpdate
。
Is there a way?有办法吗?
Some magnificent devs managed to do it on these addEventListener functions:一些出色的开发人员设法在这些 addEventListener 函数上做到了:
I think in screenshot you see typescript hint.我认为在屏幕截图中您会看到打字稿提示。 But you can do something like this :但是,你可以这样做此:
/**
* This callback is displayed as a global member.
* @callback someCallback
* @param {number} param1
* @param {number} param2
* @returns {number}
*/
/**
*
* @param {someCallback} cb
*/
function someFunction(cb) {
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.