-
Notifications
You must be signed in to change notification settings - Fork 205
Open
Description
Hi,
Google says "Does not use passive listeners to improve scrolling performance".
I need to add {passive: true} to "touchstart" and "touchmove" event.
this code :
if ('ontouchstart' in window) {
this.$el.addEventListener('touchstart', this.handleMousedown);
this.$el.addEventListener('touchend', this.handleMouseup);
this.$el.addEventListener('touchmove', this.handleMousemove);
} else {
this.$el.addEventListener('mousedown', this.handleMousedown);
this.$el.addEventListener('mouseup', this.handleMouseup);
this.$el.addEventListener('mousemove', this.handleMousemove);
}
must be replaced with below code:
if ('ontouchstart' in window) {
this.$el.addEventListener('touchstart', this.handleMousedown,{passive: true});
this.$el.addEventListener('touchend', this.handleMouseup,{passive: true});
this.$el.addEventListener('touchmove', this.handleMousemove,{passive: true});
} else {
this.$el.addEventListener('mousedown', this.handleMousedown);
this.$el.addEventListener('mouseup', this.handleMouseup);
this.$el.addEventListener('mousemove', this.handleMousemove);
}
please help me
Thank you.
Metadata
Metadata
Assignees
Labels
No labels