javascript - Is there a JavaDoc annotation that defines a function argument as a callback? -
is there javadoc way tell phpstorm javascript function accepts callback parameter?
/** * calculates , calls callback function. * * @param {string} arg1 argument. * @param {????} callback function called. **/ foo: function(arg1,callback) { //... callback(); }
you can use {function} type this, like
/** * @param {function(number):string} f * @param {number} n * @return {string} */ function foo( f, n ){ return f(n); }
see google closure compiler docs, 'type expressions' section more info
jsdoc 3 introduces @callback tag (http://usejsdoc.org/tags-callback.html), it's not yet supported (see this issue)
Comments
Post a Comment