Skip to content
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

perf: listen to touch events only on touch devices #126

Merged
merged 1 commit into from
Feb 2, 2021
Merged

perf: listen to touch events only on touch devices #126

merged 1 commit into from
Feb 2, 2021

Conversation

arturovt
Copy link
Collaborator

I've noticed that touch listeners are always removed and re-added again, this worsens performance on desktop devices or any non-touchable device.

I've added IS_TOUCH_DEVICE variable and moved listen touch calls into if conditions.

I've also removed the HostListener from the ResizeHandleDirective since I've noticed that everything is handled outsideAngularZone inside those handlers. But host listeners do cause change detection to run, I've moved their listeners into ngOnInit.

Copy link
Owner

@mattlewis92 mattlewis92 left a comment

Choose a reason for hiding this comment

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

Really nice work, thank you!

@mattlewis92 mattlewis92 changed the title feat: listen to touch events only on touch devices perf: listen to touch events only on touch devices Feb 2, 2021
@mattlewis92 mattlewis92 merged commit c85a28d into mattlewis92:master Feb 2, 2021
@arturovt arturovt deleted the feat/touch branch February 2, 2021 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants