Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documenting events? #581

Open
JC3 opened this issue Dec 19, 2022 · 0 comments
Open

Documenting events? #581

JC3 opened this issue Dec 19, 2022 · 0 comments

Comments

@JC3
Copy link

JC3 commented Dec 19, 2022

It appears that the following code is undocumentable with ESdoc (using the node.js EventEmitter):

class Example extends EventEmitter {
   doSomething () {
      ....then( () => this.emit('anevent', params) )....
   }
   // and many other methods that can also emit various events defined by this class
}

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 emits the events.

Is there a way to document this type of code with ESdoc?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant