events: support emit on nodeeventtarget#35851
events: support emit on nodeeventtarget#35851benjamingr wants to merge 1 commit intonodejs:masterfrom
Conversation
lib/internal/event_target.js
Outdated
There was a problem hiding this comment.
Name bikeshedding - welcome
lib/internal/event_target.js
Outdated
There was a problem hiding this comment.
I am not sure this is the right error to throw and I am not sure throwing is the right behavior.
Other alternatives can be:
- Wrap it in an array
- Ignore additional arguments and emit the first one
- Behave differently for emitter style and target style listeners.
There was a problem hiding this comment.
Ignore additional arguments and emit the first one
I think I’d have a mild preference for this one, but really only a mild one.
lib/internal/event_target.js
Outdated
lib/internal/event_target.js
Outdated
There was a problem hiding this comment.
Ignore additional arguments and emit the first one
I think I’d have a mild preference for this one, but really only a mild one.
lib/internal/event_target.js
Outdated
There was a problem hiding this comment.
NodeEventTarget is purely internal, so I would not mention it here, tbh. Maybe just say `.emit()` on a Node.js `EventTarget`?
|
cc @nodejs/workers |
lib/internal/event_target.js
Outdated
There was a problem hiding this comment.
Minor suggestion: use validateString from /internal/validators.
| if (typeof type !== 'string') { | |
| validateString(type, 'type') |
|
Accidentially converted to draft - will convert back, mixed this up with the AbortSignal PR 😅 |
4c1d6a7 to
f8e9bfc
Compare
Commit Queue failed- Loading data for nodejs/node/pull/35851 ✔ Done loading data for nodejs/node/pull/35851 ----------------------------------- PR info ------------------------------------ Title events: support emit on nodeeventtarget (#35851) ⚠ Could not retrieve the email or name of the PR author's from user's GitHub profile! Branch benjamingr:node-event-target-emit -> nodejs:master Labels author ready, lts-watch-v14.x, worker Commits 1 - events: support emit on nodeeventtarget Committers 1 - Benjamin Gruenbaum PR-URL: https://github.com/nodejs/node/pull/35851 Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott Reviewed-By: Yongsheng Zhang Reviewed-By: Ricky Zhou <0x19951125@gmail.com> ------------------------------ Generated metadata ------------------------------ PR-URL: https://github.com/nodejs/node/pull/35851 Reviewed-By: Anna Henningsen Reviewed-By: Rich Trott Reviewed-By: Yongsheng Zhang Reviewed-By: Ricky Zhou <0x19951125@gmail.com> -------------------------------------------------------------------------------- ⚠ Commits were pushed since the last review: ⚠ - events: support emit on nodeeventtarget ✔ Last GitHub Actions successful ℹ Last Full PR CI on 2020-11-06T10:15:15Z: https://ci.nodejs.org/job/node-test-pull-request/34119/ - Querying data for job/node-test-pull-request/34119/ ✔ Build data downloaded ✔ Last Jenkins CI successful ℹ This PR was created on Wed, 28 Oct 2020 14:25:09 GMT ✔ Approvals: 4 ✔ - Anna Henningsen (@addaleax): https://github.com/nodejs/node/pull/35851#pullrequestreview-518726152 ✔ - Rich Trott (@Trott) (TSC): https://github.com/nodejs/node/pull/35851#pullrequestreview-519608507 ✔ - Yongsheng Zhang (@ZYSzys): https://github.com/nodejs/node/pull/35851#pullrequestreview-519795411 ✔ - Ricky Zhou (@rickyes): https://github.com/nodejs/node/pull/35851#pullrequestreview-521105281 -------------------------------------------------------------------------------- ✔ Aborted `git node land` session in /home/runner/work/node/node/.ncu Commit Queue action: https://github.com/nodejs/node/actions/runs/349293015 |
|
Landed in 2a1273c...c5477be |
PR-URL: #35851 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Ricky Zhou <0x19951125@gmail.com>
PR-URL: #35851 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Ricky Zhou <0x19951125@gmail.com>
PR-URL: nodejs#35851 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Ricky Zhou <0x19951125@gmail.com>
PR-URL: nodejs#35851 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Ricky Zhou <0x19951125@gmail.com>
PR-URL: nodejs#35851 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Ricky Zhou <0x19951125@gmail.com>
NodeEventTarget.emit() is not described in document. Plus, make type parameter of removeAllListeners as optional. Refs: nodejs/node#35851
Checklist
make -j4 test(UNIX), orvcbuild test(Windows) passes