-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Add support for 'signal' option to FederatedEventTarget.addEventListener #10047
Conversation
This change brings the addEventListener implementation more in line with the DOM implementation.
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 5749f11:
|
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.
This works for me. Thank you @jmcclell
nvm, I think I got it. |
Thanks again for these PRs 👍 This was added to v8 too. |
@bigtimebuddy I just realized this contains a nefarious bug. 🤦🏻 In an effort to guarantee (which I beleive the DOM implementation does) that there is no chance the event will fire after Here is a test case that demonstrates:
For the moment, I might suggest we revert the portion of the change that wraps the listener function and keep the listener to the signal's abort function. In the meantime, I'm trying to see what the DOM implementation actually guarantees. I've always relied on it being as I wrote it, but perhaps I've just been lucky. |
@bigtimebuddy Okay, so given that browsers run JS in a single-threaded context, I believe we are safe to remove the wrapper and that it is entirely superfluous. If my understanding of the runtime semantics is correct, as soon as the Will ship up a patch. Let me know if my thinking seems correct here. JS is not my primary language. :) |
Yeah, that seems reasonable approach and simplifies the code too. |
|
Scratch that. Had some confusion on branches on my end. PR #10074 :) |
This change brings the addEventListener implementation more in line with the DOM implementation.
Description of change
Adds support for the 'signal' option to the addEventListener method of FederatedEventTarget. This makes this method more congruent with the DOM implementation. Fixes #10043
Pre-Merge Checklist
npm run lint
)npm run test
)