You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
+1 for consistency but I would go with event because it's the name used for the other methods (addListener, emit, ...).
Would you mind creating a PR to address this ?
"topic" to me sounds like something that involves a 2+-way conversation or something, when in this case it's a one-way thing. Maybe just use "event name?"
fwiw, "event name" in text makes sense to me, event in the API signature makes more sense to me:
In order to listen for the exit event, call process.on(event) with the event being the "exit" string.
Seems symmetrical and consistent - we call it the exit event, and we set the event argument to the string 'exit'. "topic" is just a word that doesn't show anywhere else in conversation about the event emitter or docs, so doesn't seem to help a lot (to me).
The DOM exposes a Event class/object to the user, but Node's EventEmitter does not. Instead EventEmitter just mentions:
listener (a function callback)
event (the name of the event)
Nothing else. And since there is no "Event" object at all it is 100% safe to use event as a simple string, because there is not anything else in the API.
Activity
targos commentedon Jan 6, 2016
+1 for consistency but I would go with
eventbecause it's the name used for the other methods (addListener, emit, ...).Would you mind creating a PR to address this ?
ibc commentedon Jan 6, 2016
Wow, I've forked the project and it found that it already uses
eventinstead oftype... :)However I've sent a PR improving it a bit.
chrisdickinson commentedon Jan 6, 2016
I've been leaning towards the term "topic" since "event" can mean both the name of the event and the actual occurrence of the event.
mscdex commentedon Jan 6, 2016
"topic" to me sounds like something that involves a 2+-way conversation or something, when in this case it's a one-way thing. Maybe just use "event name?"
sam-github commentedon Jan 6, 2016
fwiw, "event name" in text makes sense to me,
eventin the API signature makes more sense to me:Seems symmetrical and consistent - we call it the exit event, and we set the event argument to the string 'exit'. "topic" is just a word that doesn't show anywhere else in conversation about the event emitter or docs, so doesn't seem to help a lot (to me).
ibc commentedon Jan 6, 2016
The DOM exposes a Event class/object to the user, but Node's
EventEmitterdoes not. InsteadEventEmitterjust mentions:listener(a function callback)event(the name of the event)Nothing else. And since there is no "Event" object at all it is 100% safe to use
eventas a simple string, because there is not anything else in the API.ryansobol commentedon Jan 9, 2016
+1 for
event. It seems pretty harmless to change it in the future if anEventclass/object is ever added to the API.doc: use consistent event name parameter
doc: use consistent event name parameter
doc: use consistent event name parameter
doc: use consistent event name parameter
jasnell commentedon Apr 22, 2016
This can be closed. The documentation has been updated to use
eventNameconsistently