Skip to content

Commit

Permalink
Merge pull request #219 from piecioshka/master
Browse files Browse the repository at this point in the history
Resolve problem with PWA standards (passive events)
  • Loading branch information
pawelgrzybek authored Sep 23, 2024
2 parents 91bc183 + a20dd89 commit cf1553d
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/siema.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,16 +101,18 @@ export default class Siema {
preventClick: false,
};

const eventOptions = { passive: true };

// Touch events
this.selector.addEventListener('touchstart', this.touchstartHandler);
this.selector.addEventListener('touchend', this.touchendHandler);
this.selector.addEventListener('touchmove', this.touchmoveHandler);
this.selector.addEventListener('touchstart', this.touchstartHandler, eventOptions);
this.selector.addEventListener('touchend', this.touchendHandler, eventOptions);
this.selector.addEventListener('touchmove', this.touchmoveHandler, eventOptions);

// Mouse events
this.selector.addEventListener('mousedown', this.mousedownHandler);
this.selector.addEventListener('mouseup', this.mouseupHandler);
this.selector.addEventListener('mouseleave', this.mouseleaveHandler);
this.selector.addEventListener('mousemove', this.mousemoveHandler);
this.selector.addEventListener('mousedown', this.mousedownHandler, eventOptions);
this.selector.addEventListener('mouseup', this.mouseupHandler, eventOptions);
this.selector.addEventListener('mouseleave', this.mouseleaveHandler, eventOptions);
this.selector.addEventListener('mousemove', this.mousemoveHandler, eventOptions);

// Click
this.selector.addEventListener('click', this.clickHandler);
Expand Down

0 comments on commit cf1553d

Please sign in to comment.