Using ESDoc, is there a way to document events as used in code such as:
class Example extends EventEmitter {
doSomethingAsynchronously () {
....then( () => this.emit('anevent', params) )....
}
// and many other methods that can also emit various events defined by this class,
// including methods that may emit 'anevent'.
}
Here, the "anevent" event is associated with the class Example
, not with any particular method of it. Multiple methods may emit that event, and the API is designed such that it doesn't matter what method emits the event (this is the intent of events to begin with), as on('anevent', ...)
would be called on an Example
instance, not on the return value of some particular method.
Also, this code simply uses the functionality of the base EventEmitter
, it does not define any custom event code that can itself serve as a documentation target.
In other words, events are a property of the class Example
, and not of anything else.
However, ESdoc does not seem to recognize @emits
in class documentation, only in method documentation, even though it is the class that "owns" the events.
Is there a way to document the events in this type of code with ESdoc?
I mean I can always just do some custom formatted list in the class documentation, but I'm wondering if there's a built-in way to do it, first.