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: extract event listener validation as a function #55230

Merged

Conversation

sungpaks
Copy link
Contributor

@sungpaks sungpaks commented Oct 2, 2024

There was some repetitive logics that validated the existence of eventlisteners.
We now replace this with a single line of, hasEventListener(self, type).

  • self is the object(e.g. EventEmitter) to be checked whether eventlisteners exists or not.
  • type is the type of eventlisteners, which can be undefined

There was some repetitive logics that validated the existence of
eventlisteners. We now replace this with a single line of,
`hasEventListener(self, type)`.
`self` is the object(e.g. EventEmitter) to be checked whether
eventlisteners exists or not.
`type` is the type of eventlisteners, which can be `undefined`
@nodejs-github-bot nodejs-github-bot added events Issues and PRs related to the events subsystem / EventEmitter. needs-ci PRs that need a full CI run. labels Oct 2, 2024
@sungpaks sungpaks force-pushed the has-event-listener-validate-function branch from 8f5fd02 to d7a42a4 Compare October 2, 2024 01:10
Copy link

codecov bot commented Oct 2, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.40%. Comparing base (366e573) to head (d7a42a4).
Report is 308 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #55230   +/-   ##
=======================================
  Coverage   88.40%   88.40%           
=======================================
  Files         652      652           
  Lines      186565   186565           
  Branches    36038    36042    +4     
=======================================
  Hits       164935   164935           
+ Misses      14914    14900   -14     
- Partials     6716     6730   +14     
Files with missing lines Coverage Δ
lib/events.js 99.83% <100.00%> (ø)

... and 19 files with indirect coverage changes

@jazelly jazelly added the request-ci Add this label to start a Jenkins CI on a PR. label Nov 11, 2024
Copy link
Member

@jazelly jazelly left a comment

Choose a reason for hiding this comment

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

lgtm

@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Nov 11, 2024
@nodejs-github-bot
Copy link
Collaborator

nodejs-github-bot commented Nov 11, 2024

@jazelly jazelly added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Nov 12, 2024
@aduh95 aduh95 added the commit-queue Add this label to land a pull request using GitHub Actions. label Nov 14, 2024
@nodejs-github-bot nodejs-github-bot removed the commit-queue Add this label to land a pull request using GitHub Actions. label Nov 14, 2024
@nodejs-github-bot nodejs-github-bot merged commit 7a461ed into nodejs:main Nov 14, 2024
63 checks passed
@nodejs-github-bot
Copy link
Collaborator

Landed in 7a461ed

aduh95 pushed a commit that referenced this pull request Nov 16, 2024
There was some repetitive logics that validated the existence of
eventlisteners. We now replace this with a single line of,
`hasEventListener(self, type)`.
`self` is the object(e.g. EventEmitter) to be checked whether
eventlisteners exists or not.
`type` is the type of eventlisteners, which can be `undefined`

PR-URL: #55230
Reviewed-By: Jason Zhang <[email protected]>
tpoisseau pushed a commit to tpoisseau/node that referenced this pull request Nov 21, 2024
There was some repetitive logics that validated the existence of
eventlisteners. We now replace this with a single line of,
`hasEventListener(self, type)`.
`self` is the object(e.g. EventEmitter) to be checked whether
eventlisteners exists or not.
`type` is the type of eventlisteners, which can be `undefined`

PR-URL: nodejs#55230
Reviewed-By: Jason Zhang <[email protected]>
Ceres6 pushed a commit to Ceres6/node that referenced this pull request Nov 26, 2024
There was some repetitive logics that validated the existence of
eventlisteners. We now replace this with a single line of,
`hasEventListener(self, type)`.
`self` is the object(e.g. EventEmitter) to be checked whether
eventlisteners exists or not.
`type` is the type of eventlisteners, which can be `undefined`

PR-URL: nodejs#55230
Reviewed-By: Jason Zhang <[email protected]>
ruyadorno pushed a commit that referenced this pull request Nov 27, 2024
There was some repetitive logics that validated the existence of
eventlisteners. We now replace this with a single line of,
`hasEventListener(self, type)`.
`self` is the object(e.g. EventEmitter) to be checked whether
eventlisteners exists or not.
`type` is the type of eventlisteners, which can be `undefined`

PR-URL: #55230
Reviewed-By: Jason Zhang <[email protected]>
ruyadorno pushed a commit that referenced this pull request Nov 27, 2024
There was some repetitive logics that validated the existence of
eventlisteners. We now replace this with a single line of,
`hasEventListener(self, type)`.
`self` is the object(e.g. EventEmitter) to be checked whether
eventlisteners exists or not.
`type` is the type of eventlisteners, which can be `undefined`

PR-URL: #55230
Reviewed-By: Jason Zhang <[email protected]>
ruyadorno pushed a commit that referenced this pull request Nov 27, 2024
There was some repetitive logics that validated the existence of
eventlisteners. We now replace this with a single line of,
`hasEventListener(self, type)`.
`self` is the object(e.g. EventEmitter) to be checked whether
eventlisteners exists or not.
`type` is the type of eventlisteners, which can be `undefined`

PR-URL: #55230
Reviewed-By: Jason Zhang <[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. needs-ci PRs that need a full CI run.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants