-
Notifications
You must be signed in to change notification settings - Fork 6.8k
refactor(platform): add utility to normalize passive event listener options #13533
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
Conversation
Caretaker note: targeting |
* `options` parameter. | ||
* @param options Object to be normalized. | ||
*/ | ||
export function normalizePassiveEventListenerOptions(options: AddEventListenerOptions): |
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.
I would be good with shortening this to normalizePassiveListenerOptions
* `options` parameter. | ||
* @param options Object to be normalized. | ||
*/ | ||
export function normalizePassiveEventListenerOptions(options: AddEventListenerOptions): |
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.
Add a unit test for this function specifically?
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.
That won’t be very reliable, because the result depends on whether the browser supports passive events.
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.
Fair point
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
04f11bc
to
0028486
Compare
Hi @crisbeto! This PR has merge conflicts due to recent upstream merges. |
…ptions Every time we consume the `supportsPassiveEventListeners` function, we do some kind of ternary that handles the fallback in case the browser doesn't support passive listeners. Since this can be cumbersome and error-prone, these changes add a function that will normalize the object automatically.
0028486
to
f00e98a
Compare
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Every time we consume the
supportsPassiveEventListeners
function, we do some kind of ternary that handles the fallback in case the browser doesn't support passive listeners. Since this can be cumbersome and error-prone, these changes add a function that will normalize the object automatically.