zingtouch icon indicating copy to clipboard operation
zingtouch copied to clipboard

Support passive event listeners

Open Chaoste opened this issue 8 years ago • 4 comments

Hi,

Can you add passive event listeneres as mentioned this SO post? I'm getting browser warnings in Chrome right now due to this problem.

Greetings, Thomas

Chaoste avatar Oct 02 '17 12:10 Chaoste

Taken from Modernizr:

var supportsPassiveOption = false;
    try {
      var opts = Object.defineProperty({}, 'passive', {
        get: function() {
          supportsPassiveOption = true;
        }
      });
      window.addEventListener('test', null, opts);
    } catch (e) {}

Edited: see comment below.

markadrake avatar Oct 20 '17 23:10 markadrake

I started by hard coding the passive: true into place, and now I've paired it to use of preventDefault. You can see the 2 commits I've made already here: https://github.com/markadrake/zingtouch/tree/passive-event-listeners.

I think there's just one more thing which is using the right value for State.js where there is another addEventListener but no reference to whether preventDefault will be called.

markadrake avatar Oct 21 '17 00:10 markadrake

Hi,

Thanks for your answer! Unfortunately my team switched to HammerJS for the moment because it might work better for Edge/Explorer.

Chaoste avatar Nov 16 '17 15:11 Chaoste

@Chaoste How did you find it? On my initial research I found this library to be superior.

1ubuntuuser avatar Dec 19 '17 19:12 1ubuntuuser