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

Document abortable event listeners #2759

Merged
merged 4 commits into from
Mar 1, 2021

Conversation

sideshowbarker
Copy link
Collaborator

@sideshowbarker sideshowbarker commented Feb 28, 2021

This PR includes the following changes:

  • Document the signal parameter for the addEventListener() options object
  • “Add an abortable listener” example code added to addEventListener() article
  • Add similar simple example code to he “Introduction to events” guide
  • In both the “Introduction to events” guide and removeEventListener() article, add prose mentions that you can pass an AbortSignal to an addEventListener() call, and abort/cancel/remove the listener by calling abort() on the controller owning the AbortSignal.

Related:

It also includes some clean-up changes:

  • Drop link to non-standard/undocumented detachEvent
  • Copy edits for “Introduction to events”
  • Push “fix fixable flaws” for removeEventListener()

@sideshowbarker sideshowbarker requested a review from a team as a code owner February 28, 2021 09:24
@sideshowbarker sideshowbarker requested a review from a team February 28, 2021 09:24
@sideshowbarker sideshowbarker requested a review from a team as a code owner February 28, 2021 09:24
@sideshowbarker sideshowbarker requested review from chrisdavidmills and removed request for a team February 28, 2021 09:24
This patch includes the following changes:

- Document the "signal" parameter for the addEventListener() options object
- “Add an abortable listener” example code added to addEventListener() article
- Add a similar simple example code to he “Introduction to events” guide
- In both “Introduction to events” guide and removeEventListener() article,
  add prose mentions that you can pass an AbortSignal to an addEventListener()
  call, and abort/cancel/remove the listener by calling abort() on the
  controller owning the AbortSignal.

Related:

- whatwg/dom@83037a1
- https://dom.spec.whatwg.org/#dictdef-addeventlisteneroptions
- https://dom.spec.whatwg.org/#ref-for-concept-event-listener①
- https://dom.spec.whatwg.org/#ref-for-abortsignal③
@sideshowbarker sideshowbarker force-pushed the sideshowbarker/addeventlistener-abortable branch from 93fef08 to 8e31499 Compare February 28, 2021 09:36
@sideshowbarker
Copy link
Collaborator Author

@annevk, would be good to have your review on this if you have time — just the 8e31499 commit (the other commits in this PR are supplementary clean-up changes)

Copy link
Contributor

@annevk annevk left a comment

Choose a reason for hiding this comment

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

Generally looks good, bit did spot a mistake in the old text. Some of this made me wonder whether once is documented and whether it's perhaps a bit too much on the "don't worry about memory leaks" front.

@Ryuno-Ki
Copy link
Collaborator

Looks like another team member / @chrisdavidmills needs to review this before it can be merged.

Copy link
Contributor

@chrisdavidmills chrisdavidmills left a comment

Choose a reason for hiding this comment

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

LGTM; I'm happy to merge this if @sideshowbarker is happy.

@sideshowbarker
Copy link
Collaborator Author

LGTM; I'm happy to merge this if @sideshowbarker is happy.

Yup — think it’s good to go

@chrisdavidmills chrisdavidmills merged commit 010fcff into main Mar 1, 2021
@chrisdavidmills chrisdavidmills deleted the sideshowbarker/addeventlistener-abortable branch March 1, 2021 12:43
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 12, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants