-
Notifications
You must be signed in to change notification settings - Fork 46.9k
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 part of the event responder system for experimental event API #15179
Conversation
This comment has been minimized.
This comment has been minimized.
I've added more test coverage and added comments around some of the logic involved in handling the active event component fibers. |
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.
You have CI build errors which cover up the file size changes (if any).
this._nonDiscreteEvents = []; | ||
} | ||
|
||
DOMEventResponderContext.prototype.isPassive = function(): boolean { |
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.
Can we avoid using methods on prototypes and instead call it with an argument - like we do in the newer code? function isPassive(context: DOMEventResponderContext){ ... }
Methods are much harder to analyze for GCC and requires a virtual dispatch for every call. With stand alone functions we can feel good about getting automatic inlining and DCE with use of future feature flags and such.
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.
context
is passed to the event responder module so that the user can call isPassive
etc without having to know about the React internals. I thought about exposing these functions via a public API on React, but that felt like over-kill, especially as the responder modules are external to React.
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.
Cool. I don't fully see how everything will fit together. We can come back to this later once more stuff is in place.
ReactDOM: size: 0.0%, gzip: 0.0% Details of bundled changes.Comparing: 78f2775...ea86b4b react-dom
Generated by 🚫 dangerJS |
this._nonDiscreteEvents = []; | ||
} | ||
|
||
DOMEventResponderContext.prototype.isPassive = function(): boolean { |
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.
Cool. I don't fully see how everything will fit together. We can come back to this later once more stuff is in place.
I spoke to @sebmarkbage and he was happy with getting this PR in so I'm merging. |
Note: this is for an experimental event API that we're testing out internally at Facebook.
This PR adds logic to handle triggering event responders from events that are listened to at a top level. This follows on from previous PRs:
This PR also adds tests that validate the triggering of event responder
handleEvent
function.