Skip to content

events: support emit on nodeeventtarget - #35851

Closed
benjamingr wants to merge 1 commit into
nodejs:masterfrom
benjamingr:node-event-target-emit
Closed

events: support emit on nodeeventtarget#35851
benjamingr wants to merge 1 commit into
nodejs:masterfrom
benjamingr:node-event-target-emit

Conversation

@benjamingr

Copy link
Copy Markdown
Member
Checklist
  • make -j4 test (UNIX), or vcbuild test (Windows) passes
  • tests and/or benchmarks are included
  • documentation is changed or added
  • commit message follows commit guidelines

@nodejs-github-botnodejs-github-bot added the worker Issues and PRs related to Worker support. label Oct 28, 2020
Comment threadlib/internal/event_target.js Outdated

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Name bikeshedding - welcome

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 from me

Comment threadlib/internal/event_target.js Outdated

Copy link
Copy Markdown
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment threadlib/internal/worker/io.js Outdated
Comment threadlib/internal/event_target.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 from me

Comment threadlib/internal/event_target.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment threadlib/internal/event_target.js Outdated
Comment on lines 483 to 484

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NodeEventTarget is purely internal, so I would not mention it here, tbh. Maybe just say `.emit()` on a Node.js `EventTarget`?

Comment threadlib/internal/worker/io.js Outdated
@benjamingrbenjamingr added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Oct 28, 2020
@benjamingr

Copy link
Copy Markdown
MemberAuthor

cc @nodejs/workers

@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 29, 2020
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Comment threadlib/internal/event_target.js Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor suggestion: use validateString from /internal/validators.

Suggested change
if(typeoftype!=='string'){
validateString(type,'type')

@benjamingr
benjamingr marked this pull request as draft October 31, 2020 09:33
@benjamingr

Copy link
Copy Markdown
MemberAuthor

Accidentially converted to draft - will convert back, mixed this up with the AbortSignal PR 😅

@benjamingr
benjamingr marked this pull request as ready for review October 31, 2020 09:35
@benjamingrbenjamingr added the request-ci Add this label to start a Jenkins CI on a PR. label Oct 31, 2020
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Oct 31, 2020
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@benjamingr
benjamingrforce-pushed the node-event-target-emit branch from 4c1d6a7 to f8e9bfcCompareNovember 4, 2020 10:21
@benjamingrbenjamingr added the request-ci Add this label to start a Jenkins CI on a PR. label Nov 4, 2020
@github-actionsgithub-actionsBot removed the request-ci Add this label to start a Jenkins CI on a PR. label Nov 4, 2020
@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

@benjamingrbenjamingr added the request-ci Add this label to start a Jenkins CI on a PR. label Nov 5, 2020
@benjamingrbenjamingr added the commit-queue Add this label to land a pull request using GitHub Actions. label Nov 6, 2020
@github-actionsgithub-actionsBot added commit-queue-failed An error occurred while landing this pull request using GitHub Actions. and removed commit-queue Add this label to land a pull request using GitHub Actions. labels Nov 6, 2020
@github-actions

Copy link
Copy Markdown
Contributor
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

@addaleaxaddaleax added commit-queue Add this label to land a pull request using GitHub Actions. and removed commit-queue-failed An error occurred while landing this pull request using GitHub Actions. labels Nov 6, 2020
@github-actionsgithub-actionsBot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Nov 6, 2020
@github-actions

Copy link
Copy Markdown
Contributor

Landed in 2a1273c...c5477be

nodejs-github-bot pushed a commit that referenced this pull request Nov 6, 2020
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>
danielleadams pushed a commit that referenced this pull request Nov 9, 2020
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>
@danielleadamsdanielleadams mentioned this pull request Nov 9, 2020
targos pushed a commit to targos/node that referenced this pull request Apr 30, 2021
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>
targos pushed a commit that referenced this pull request Apr 30, 2021
PR-URL: #35851
Backport-PR-URL: #38386
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>
@targostargos added backported-to-v14.x and removed author ready PRs that have at least one approval, no pending requests for changes, and a CI started. backport-open-v14.x labels Apr 30, 2021
@danielleadamsdanielleadams mentioned this pull request May 3, 2021
@F3n67uF3n67u mentioned this pull request Jun 21, 2022
deokjinkim added a commit that referenced this pull request Feb 20, 2023
NodeEventTarget.emit() is not described in document. Plus, make
type parameter of removeAllListeners as optional.
Refs: #35851
PR-URL: #46356
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
targos pushed a commit that referenced this pull request Mar 13, 2023
NodeEventTarget.emit() is not described in document. Plus, make
type parameter of removeAllListeners as optional.
Refs: #35851
PR-URL: #46356
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
danielleadams pushed a commit that referenced this pull request Apr 11, 2023
NodeEventTarget.emit() is not described in document. Plus, make
type parameter of removeAllListeners as optional.
Refs: #35851
PR-URL: #46356
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
abhishekumar-tyagi pushed a commit to abhishekumar-tyagi/node that referenced this pull request May 5, 2024
NodeEventTarget.emit() is not described in document. Plus, make
type parameter of removeAllListeners as optional.
Refs: nodejs/node#35851
Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Labels

workerIssues and PRs related to Worker support.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants

@benjamingr@nodejs-github-bot@Trott@addaleax@rickyes@ZYSzys@targos