Skip to content

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

Merged
merged 1 commit into from
Oct 19, 2018

Conversation

crisbeto
Copy link
Member

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.

@crisbeto crisbeto added merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: major This PR is targeted for the next major release labels Oct 10, 2018
@googlebot googlebot added the cla: yes PR author has agreed to Google's Contributor License Agreement label Oct 10, 2018
@crisbeto
Copy link
Member Author

Caretaker note: targeting major since it changes something in drag-drop, but it's not something that needs to get in for 7.0 stable. If we release stable before this is merged in, it can be bumped back to a patch.

* `options` parameter.
* @param options Object to be normalized.
*/
export function normalizePassiveEventListenerOptions(options: AddEventListenerOptions):
Copy link
Member

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):
Copy link
Member

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?

Copy link
Member Author

@crisbeto crisbeto Oct 10, 2018

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.

Copy link
Member

Choose a reason for hiding this comment

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

Fair point

Copy link
Member

@jelbourn jelbourn left a comment

Choose a reason for hiding this comment

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

LGTM

@jelbourn jelbourn added pr: lgtm action: merge The PR is ready for merge by the caretaker labels Oct 10, 2018
@crisbeto crisbeto force-pushed the normalize-options-util branch from 04f11bc to 0028486 Compare October 11, 2018 07:17
@crisbeto crisbeto added target: patch This PR is targeted for the next patch release and removed target: major This PR is targeted for the next major release labels Oct 18, 2018
@josephperrott josephperrott added pr: needs rebase and removed action: merge The PR is ready for merge by the caretaker labels Oct 19, 2018
@ngbot
Copy link

ngbot bot commented Oct 19, 2018

Hi @crisbeto! This PR has merge conflicts due to recent upstream merges.
Please help to unblock it by resolving these conflicts. Thanks!

…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.
@crisbeto crisbeto force-pushed the normalize-options-util branch from 0028486 to f00e98a Compare October 19, 2018 19:54
@crisbeto crisbeto added action: merge The PR is ready for merge by the caretaker and removed pr: needs rebase labels Oct 19, 2018
@josephperrott josephperrott merged commit 992bcfb into angular:master Oct 19, 2018
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
action: merge The PR is ready for merge by the caretaker cla: yes PR author has agreed to Google's Contributor License Agreement merge: caretaker note Alert the caretaker performing the merge to check the PR for an out of normal action needed or note target: patch This PR is targeted for the next patch release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants