-
Notifications
You must be signed in to change notification settings - Fork 22.5k
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
Document abortable event listeners #2759
Conversation
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③
93fef08
to
8e31499
Compare
There was a problem hiding this 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.
Looks like another team member / @chrisdavidmills needs to review this before it can be merged. |
There was a problem hiding this 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.
Yup — think it’s good to go |
This PR includes the following changes:
signal
parameter for theaddEventListener()
options objectaddEventListener()
articleremoveEventListener()
article, add prose mentions that you can pass anAbortSignal
to anaddEventListener()
call, and abort/cancel/remove the listener by callingabort()
on the controller owning theAbortSignal
.Related:
It also includes some clean-up changes: