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

events: simplify event target agnostic logic in on and once #34997

Closed

Conversation

lundibundi
Copy link
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

This simplifies logic related to EventTarget handling and shortens the code.

/cc @nodejs/events @jasnell

@lundibundi lundibundi added events Issues and PRs related to the events subsystem / EventEmitter. request-ci Add this label to start a Jenkins CI on a PR. labels Aug 31, 2020
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Aug 31, 2020
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

Copy link
Member

@benjamingr benjamingr left a comment

Choose a reason for hiding this comment

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

I am confused regarding why the code was the way it was originally lol

@lundibundi lundibundi added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Sep 6, 2020
@lundibundi lundibundi added the commit-queue Add this label to land a pull request using GitHub Actions. label Sep 6, 2020
@github-actions github-actions bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Sep 6, 2020
@github-actions
Copy link
Contributor

github-actions bot commented Sep 6, 2020

Commit Queue failed
- Loading data for nodejs/node/pull/34997
✔  Done loading data for nodejs/node/pull/34997
----------------------------------- PR info ------------------------------------
Title      events: simplify event target agnostic logic in on and once (#34997)
Author     Denys Otrishko  (@lundibundi)
Branch     lundibundi:improve-events-event-target -> nodejs:master
Labels     author ready, events
Commits    1
 - events: simplify event target agnostic logic in on and once
Committers 1
 - Denys Otrishko 
PR-URL: https://github.com/nodejs/node/pull/34997
Reviewed-By: Benjamin Gruenbaum 
Reviewed-By: Yongsheng Zhang 
------------------------------ Generated metadata ------------------------------
PR-URL: https://github.com/nodejs/node/pull/34997
Reviewed-By: Benjamin Gruenbaum 
Reviewed-By: Yongsheng Zhang 
--------------------------------------------------------------------------------
   ✔  Last GitHub Actions successful
   ℹ  Last Full PR CI on 2020-08-31T19:35:13Z: https://ci.nodejs.org/job/node-test-pull-request/32986/
- Querying data for job/node-test-pull-request/32986/
✔  Build data downloaded
   ✔  Last Jenkins CI successful
   ℹ  This PR was created on Mon, 31 Aug 2020 17:45:45 GMT
   ✔  Approvals: 2
   ✔  - Benjamin Gruenbaum (@benjamingr): https://github.com/nodejs/node/pull/34997#pullrequestreview-479543094
   ✔  - Yongsheng Zhang (@ZYSzys): https://github.com/nodejs/node/pull/34997#pullrequestreview-483128689
--------------------------------------------------------------------------------
   ✔  No git am in progress
   ✔  No git rebase in progress
--------------------------------------------------------------------------------
- Bringing origin/master up to date...
From https://github.com/nodejs/node
 * branch              master     -> FETCH_HEAD
✔  origin/master is now up-to-date
- Downloading patch for 34997
✔  Downloaded patch to /home/runner/work/node/node/.ncu/34997/patch
--------------------------------------------------------------------------------
error: patch failed: lib/events.js:793
error: lib/events.js: patch does not apply
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Applying: events: simplify event target agnostic logic in on and once
Patch failed at 0001 events: simplify event target agnostic logic in on and once
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
--------------------------------------------------------------------------------
Applying: events: simplify event target agnostic logic in on and once
error: sha1 information is lacking or useless (lib/events.js).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 events: simplify event target agnostic logic in on and once
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

@github-actions github-actions bot added the commit-queue-failed An error occurred while landing this pull request using GitHub Actions. label Sep 6, 2020
lundibundi added a commit that referenced this pull request Sep 11, 2020
PR-URL: #34997
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Yongsheng Zhang <[email protected]>
@lundibundi
Copy link
Member Author

Landed in b1831fe

@lundibundi lundibundi closed this Sep 11, 2020
@lundibundi lundibundi deleted the improve-events-event-target branch September 11, 2020 15:05
@ruyadorno
Copy link
Member

this doesn't land cleanly on v14.x, should it be backported?

@lundibundi
Copy link
Member Author

@ruyadorno these changes were applied on top of other changes related to AbortController (#34911). I think it shouldn't be backported since AbortController is semver-major.

joesepi pushed a commit to joesepi/node that referenced this pull request Jan 8, 2021
PR-URL: nodejs#34997
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Reviewed-By: Yongsheng Zhang <[email protected]>
@targos targos removed the commit-queue-failed An error occurred while landing this pull request using GitHub Actions. label Sep 5, 2021
daeyeon added a commit to daeyeon/node that referenced this pull request Jun 11, 2022
Event listeners pased to un/subscribe the `abort` event are mismatched.
This removes the wrapper function in `eventTargetAgnosticAddListener()`
and directly passes the given listener to the `EventTarget`.

IMO, removing the wrapper seems harmless, and the `AbortSignal` is
seemingly the only `EventTarget` passed to this function for now.

Fixes: nodejs#43337
Refs: nodejs#33659
Refs: nodejs#34997

Signed-off-by: Daeyeon Jeong [email protected]
daeyeon added a commit to daeyeon/node that referenced this pull request Jun 11, 2022
Event listeners passed to un/subscribe the abort event are mismatched.
This removes the wrapper function in `eventTargetAgnosticAddListener()`
and directly passes the given listener to the `EventTarget`.

IMO, removing the wrapper seems harmless, and the `AbortSignal` is
seemingly the only `EventTarget` passed to this function for now.

Fixes: nodejs#43337
Refs: nodejs#33659
Refs: nodejs#34997

Signed-off-by: Daeyeon Jeong [email protected]
nodejs-github-bot pushed a commit that referenced this pull request Jun 14, 2022
Event listeners passed to un/subscribe the abort event are mismatched.
This removes the wrapper function in `eventTargetAgnosticAddListener()`
and directly passes the given listener to the `EventTarget`.

IMO, removing the wrapper seems harmless, and the `AbortSignal` is
seemingly the only `EventTarget` passed to this function for now.

Fixes: #43337
Refs: #33659
Refs: #34997

Signed-off-by: Daeyeon Jeong [email protected]

PR-URL: #43373
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
danielleadams pushed a commit that referenced this pull request Jun 16, 2022
Event listeners passed to un/subscribe the abort event are mismatched.
This removes the wrapper function in `eventTargetAgnosticAddListener()`
and directly passes the given listener to the `EventTarget`.

IMO, removing the wrapper seems harmless, and the `AbortSignal` is
seemingly the only `EventTarget` passed to this function for now.

Fixes: #43337
Refs: #33659
Refs: #34997

Signed-off-by: Daeyeon Jeong [email protected]

PR-URL: #43373
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
targos pushed a commit that referenced this pull request Jul 12, 2022
Event listeners passed to un/subscribe the abort event are mismatched.
This removes the wrapper function in `eventTargetAgnosticAddListener()`
and directly passes the given listener to the `EventTarget`.

IMO, removing the wrapper seems harmless, and the `AbortSignal` is
seemingly the only `EventTarget` passed to this function for now.

Fixes: #43337
Refs: #33659
Refs: #34997

Signed-off-by: Daeyeon Jeong [email protected]

PR-URL: #43373
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
targos pushed a commit that referenced this pull request Jul 31, 2022
Event listeners passed to un/subscribe the abort event are mismatched.
This removes the wrapper function in `eventTargetAgnosticAddListener()`
and directly passes the given listener to the `EventTarget`.

IMO, removing the wrapper seems harmless, and the `AbortSignal` is
seemingly the only `EventTarget` passed to this function for now.

Fixes: #43337
Refs: #33659
Refs: #34997

Signed-off-by: Daeyeon Jeong [email protected]

PR-URL: #43373
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
guangwong pushed a commit to noslate-project/node that referenced this pull request Oct 10, 2022
Event listeners passed to un/subscribe the abort event are mismatched.
This removes the wrapper function in `eventTargetAgnosticAddListener()`
and directly passes the given listener to the `EventTarget`.

IMO, removing the wrapper seems harmless, and the `AbortSignal` is
seemingly the only `EventTarget` passed to this function for now.

Fixes: nodejs/node#43337
Refs: nodejs/node#33659
Refs: nodejs/node#34997

Signed-off-by: Daeyeon Jeong [email protected]

PR-URL: nodejs/node#43373
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Benjamin Gruenbaum <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author ready PRs that have at least one approval, no pending requests for changes, and a CI started. events Issues and PRs related to the events subsystem / EventEmitter.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants