Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[🚀esl-utils]: Proposal: getEventListeners() method for SynteticEventTarget #1540

Closed
ala-n opened this issue Mar 10, 2023 · 1 comment · Fixed by #1548
Closed

[🚀esl-utils]: Proposal: getEventListeners() method for SynteticEventTarget #1540

ala-n opened this issue Mar 10, 2023 · 1 comment · Fixed by #1548
Assignees
Labels
enhancement Improvements and additions to code released

Comments

@ala-n
Copy link
Collaborator

ala-n commented Mar 10, 2023

As an ESL consumer, I want to have a more understandable check for a listener's count than this.hasEventListener(type, min)

Proposal:
Add getEventListeners method with the following signature:

   protected getEventListeners(): EventListener[]; // Returns all event listeners of the SyntetycEvent target
   protected getEventListeners(type: string): EventListener[]; // Returns all event listeners of the SyntetycEvent target that handles passed event type

NTH: reuse method inside hasEventListener()
Deprecate: numeric and second parm for hasEventListener()

Internal code update and deprecation suggestion:
this.hasEventListener(event, 1) => this.getEventListeners(event).length > 1

@ala-n ala-n added the waits triage Issue that waits to be reviewed and handled label Mar 10, 2023
@ala-n ala-n self-assigned this Mar 10, 2023
@ala-n ala-n added needs assignee and removed waits triage Issue that waits to be reviewed and handled labels Mar 10, 2023
@ala-n ala-n added this to the ⚡ESL: 4.4.0 Minor release milestone Mar 10, 2023
@ala-n ala-n added enhancement Improvements and additions to code and removed needs assignee labels Mar 10, 2023
@ala-n
Copy link
Collaborator Author

ala-n commented Apr 12, 2023

🎉 This issue has been resolved in version 4.4.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@ala-n ala-n added the released label Apr 12, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
enhancement Improvements and additions to code released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants