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-event-listener]: ability to receive additional event information related to listener (element target, selected target) #1675

Closed
ala-n opened this issue May 25, 2023 · 1 comment · Fixed by #1693
Assignees
Labels

Comments

@ala-n
Copy link
Collaborator

ala-n commented May 25, 2023

As an ESL consumer, I want to be able to access current event delegated target.

Use Case: event delegation
Shortcut for

@listen({ event: 'some', selector: '.delegate.selector' })
onSomeEvent(e: Event) {
  const {target} = e;
  const $delegate = target && target.closest('.delegate.selector'); // <- that one
  ...
}

Additional context: the ability to receive event listener as handler parameter was lost in bounds of #983 request implementation
It is rejected originally to have common information in simple cases for debugging reasons and receive listeners in general by API reasons.
Nevertheless, the delegation case is more specific and can be extended (by second param or original event mixing)


Architecture proposal (by @ala-n)

User API:

  @listen({ event: 'some', selector: '.delegate.selector' })
  onSomeEvent(e: DelegatedEvent<EventType>) {
    const {$delegate} = e; // available out of the box
    ...
  }
@ala-n ala-n added the waits triage Issue that waits to be reviewed and handled label May 25, 2023
@ala-n ala-n self-assigned this May 25, 2023
@ala-n ala-n changed the title [🚀esl-event-listener]: ability to receive listener information (element target, selected target) [🚀esl-event-listener]: ability to receive additional event information related to listener (element target, selected target) May 25, 2023
@ala-n ala-n added this to the ⚡ESL: 4.7.0 Minor release milestone May 25, 2023
@abarmina abarmina assigned abarmina and unassigned ala-n May 25, 2023
@abarmina abarmina linked a pull request May 31, 2023 that will close this issue
@ala-n ala-n added feature New feature and removed waits triage Issue that waits to be reviewed and handled labels Jun 5, 2023
ala-n pushed a commit that referenced this issue Jun 9, 2023
# [4.7.0](v4.6.0...v4.7.0) (2023-06-09)

### Bug Fixes

* **esl-utils:** fix sequence finder behaviour in case step function leads to loop ([c23e2c2](c23e2c2))

### Code Refactoring

* **esl-carousel:** remove legacy esl-carousel implementation ([b31599a](b31599a))

### Features

* **esl-event-listener:** add the ability to get the current delegated event target ([#1675](#1675)) ([8b4b089](8b4b089))
* **esl-popup:** change the logic of auto injection of arrow ([a7ba04c](a7ba04c))
* **esl-utils:** add `findNextLooped` and `findPrevLooped` common traversing utility ([80a4e67](80a4e67))
* **esl-utils:** add `promisifyNextRender` common utility ([3a93887](3a93887))
* **esl-utils:** introduce `promisifyTransition` utility ([68d0556](68d0556))
* **esl-utils:** utility to postpone execution to microtask ([4f4f637](4f4f637))

### BREAKING CHANGES

* **esl-carousel:** `draft/esl-carousel` no longer available
@ala-n
Copy link
Collaborator Author

ala-n commented Jun 9, 2023

🎉 This issue has been resolved in version 4.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@ala-n ala-n added the released label Jun 9, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants