Skip to content

Commit

Permalink
Add documentation for non-passive event listeners
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelmeuli committed Nov 26, 2018
1 parent 25bfa9a commit c1621a3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Magnifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ export default class Magnifier extends PureComponent {
}

componentDidMount() {
// Add non-passive event listeners to image img (assigned in render function)
// Add mouse/touch event listeners to image element (assigned in render function)
// `passive: false` prevents scrolling on touch move
this.img.addEventListener('mousemove', this.onMouseMove, { passive: false });
this.img.addEventListener('mouseout', this.onMouseOut, { passive: false });
this.img.addEventListener('touchstart', this.onTouchStart, { passive: false });
Expand Down

0 comments on commit c1621a3

Please sign in to comment.