Skip to content
This repository was archived by the owner on Aug 24, 2020. It is now read-only.

Commit fbdfb0b

Browse files
Fix: set listener to passive mode
1 parent 13bfd7e commit fbdfb0b

File tree

4 files changed

+13
-9
lines changed

4 files changed

+13
-9
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
<a name="2.2.3"></a>
2+
## [2.2.3](https://github.com/peterpeterparker/ionic-swing/compare/v2.2.2...v2.2.3) (2018-08-18)
3+
* **fix**: Fix Chrome complains "Added non-passive event listener to a scroll-blocking..." (see [Hammerjs commit #987](https://github.com/hammerjs/hammer.js/pull/987/commits/49cd23d30d9618c5e8b14dd4412f94454143e080))
4+
15
<a name="2.2.2"></a>
26
## [2.2.2](https://github.com/peterpeterparker/ionic-swing/compare/v2.2.1...v2.2.2) (2018-08-18)
37
* **fix**: `stack.destroyCard` was wrongly implemented

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ionic-swing",
3-
"version": "2.2.2",
3+
"version": "2.2.3",
44
"license": "MIT",
55
"scripts": {
66
"ng": "ng",

src/app/modules/ionic-swing/swing/card.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -316,15 +316,15 @@ const Card = (stack, targetElement) => {
316316
if (isTouchDevice()) {
317317
targetElement.addEventListener('touchstart', () => {
318318
eventEmitter.trigger('panstart');
319-
});
319+
}, { passive: true });
320320

321321
targetElement.addEventListener('touchend', () => {
322322
if (isDraging && !isPanning) {
323323
eventEmitter.trigger('dragend', {
324324
target: targetElement
325325
});
326326
}
327-
});
327+
}, { passive: true });
328328

329329
// Disable scrolling while dragging the element on the touch enabled devices.
330330
// @see http://stackoverflow.com/a/12090055/368691
@@ -333,30 +333,30 @@ const Card = (stack, targetElement) => {
333333

334334
targetElement.addEventListener('touchstart', () => {
335335
dragging = true;
336-
});
336+
}, { passive: true });
337337

338338
targetElement.addEventListener('touchend', () => {
339339
dragging = false;
340-
});
340+
}, { passive: true });
341341

342342
global.addEventListener('touchmove', (event) => {
343343
if (dragging) {
344344
event.preventDefault();
345345
}
346-
});
346+
}, { passive: true });
347347
})();
348348
} else {
349349
targetElement.addEventListener('mousedown', () => {
350350
eventEmitter.trigger('panstart');
351-
});
351+
}, { passive: true });
352352

353353
targetElement.addEventListener('mouseup', () => {
354354
if (isDraging && !isPanning) {
355355
eventEmitter.trigger('dragend', {
356356
target: targetElement
357357
});
358358
}
359-
});
359+
}, { passive: true });
360360
}
361361

362362
mc.on('panstart', (event) => {

0 commit comments

Comments
 (0)