I've read the documentation about @event and it seems its only for one argument callback. What if I've something like:
this.emit('eventName', 'foo', {});
If you don't want to document this as an event named foo, one other option is to use the @callback tag, which allows you to document an arbitrary number of parameters.
I'll leave a +1 for actually supporting this syntax. Data emitted by events are not limited to one parameter.
Sorry for the misunderstand, what I want to document is an event, not a callback parameter of a function.
Please reconsider reopening the issue.
Single data events are ok for W3C APIs (like browsers), but on Node.js or jQuery styles is acceptable to emit several arguments, +1 to support this syntax.
+1 from me too.
Actually, now that I've figured out how to spell module:MyModule~MyClass#event:myevent (!) providing multiple @param tags within an @event documentation comment appears to work fine. Well done, whoever did this.
Could you be able to provide us an example how did you do it?
Put the following into a fileev.js and run jsdoc ev.js:
/**
* @file A file
*
* @module ArmActions
*/
/**
* A thrower.
*
* Related event is {@link module:ArmActions~Hurl#event:snowball}.
*
* @constructor
*/
function Hurl () { }
/**
* Throw a snowball.
*
* @fires module:ArmActions~Hurl#snowball
*/
Hurl.prototype.snowball = function() {
// ...
};
/**
* Snowball event.
*
* @event module:ArmActions~Hurl#snowball
* @param {boolean} isPacked - Indicates whether the snowball is tightly packed.
* @param {boolean} [hasRock] - Indicates the thrower is malicious.
*/
Maybe I'm wrong, but seems to me this define an event object, not a Node.js-like event with several parameters...
Then perhaps I'm mis-using the tag; what I'm intending to do is document that a subclass of EventEmitter emits an event named snowball which should be received like this:
hurler.on('snowball', function(isPacked, hasRock) {
// ...
})
Excepting that the default jsdoc template lists these under an Events block just like Modules and Classes, which seems weird, it does what I want. I'm only using JavaScript under Node.js so if this is supposed to be used for browser events which are something different then perhaps it would help to give an example of the use you want supported.
Is this still not possible? This is a very essential feature. I can't think of one event-driven module I've written that I could document properly without this. Is jsdoc even meant to be used with node.js?
Any updates on this?
Using multiple @param directives works fine.
Most helpful comment
Is this still not possible? This is a very essential feature. I can't think of one event-driven module I've written that I could document properly without this. Is jsdoc even meant to be used with node.js?