Open VividVisions opened 9 months ago
If you have a simple example of code of such situation, it would be appreciated.
import { EventEmitter } from 'node:events';
/**
* Test class
*/
class Test extends EventEmitter {
/**
* Foo function.
* @emits {bar}
*/
foo(str) {
this.emit('bar', str);
return str + '!';
}
/**
* Bar function.
*/
bar(num) {
return num + 1;
}
}
This would link the event bar
to the method bar
in the rendered HTML.
And there don't seem to be a way to document events as their own symbols. Something like that:
/**
* Event bar.
* Gets fired when foo() is called.
*
* @event bar
* @param {String} - The string
*/
Yes, this should be easily detected by ESDoc as two different kinds, The @variation
tag should also work, but it's not implemented. This can be hacked in, if needed, otherwise updated JSDoc parsing and detection will fix it in future.
Is there a way to differentiate an event from a method if they have the same name (other than renaming one or both)? How to document the event itself?