question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support for passive event listeners

See original GitHub issue

VueJS offers a .passive to make an event listener passive to improve performance https://vuejs.org/v2/guide/events.html#main , is there a way to achieve the same with this library?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
keaton-codes-techcommented, Aug 17, 2020

VueJS offers a .passive to make an event listener passive to improve performance https://vuejs.org/v2/guide/events.html#main , is there a way to achieve the same with this library?

To answer the OP, if you look at the code you will see that there is a check if the browser does support passive var isPassiveSupported = (function() { var supportsPassive = false; try { var opts = Object.defineProperty({}, 'passive', { get: function() { supportsPassive = true; } }); window.addEventListener('test', null, opts); } catch (e) {} return supportsPassive; })();

the boolean returned from this is used to set if the event listener is passive: true or false

0reactions
jerrybendycommented, Aug 17, 2020

@oldbootz I have simplified your code (merge two case branch into one). And release a new version v2.3.0. Thanks a lot

Read more comments on GitHub >

github_iconTop Results From Across the Web

Passive event listeners | Can I use... Support tables for HTML5 ...
Event listeners created with the passive: true option cannot cancel ( preventDefault() ) the events they receive. Primarily intended to be used with...
Read more >
Use passive listeners to improve scrolling performance
Touch and wheel event listeners are useful for tracking user interactions and creating custom scrolling experiences, but they can also delay ...
Read more >
What are passive event listeners? - javascript - Stack Overflow
Passive event listeners are an emerging web standard, new feature shipped in Chrome 51 that provide a major potential boost to scroll performance....
Read more >
Passive Event Listeners: Solution to ''Does not use ... - Screpy
What Passive Event Listeners basically does is try to eliminate the need for waiting for the work of touch and wheel event listeners...
Read more >
Cross Browser Compatibility Score of Passive event listeners
Browser Support for Passive event listeners · Chrome · Safari · Firefox · IE Internet Explorer · Opera · Edge ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found