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

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -