-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add possibility to pass options to addEventListener #3
base: master
Are you sure you want to change the base?
Conversation
@@ -26,7 +26,7 @@ class EventsDelegation extends Mixin | |||
eachPair events, (event, callback) => | |||
unless eventsForObject[event]? | |||
eventsForObject[event] = {} | |||
disposablesForObject[event] = @createEventListener(object, event) | |||
disposablesForObject[event] = @createEventListener(object, event, options) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could also enable users to define options on an event by event basis but I guess this API is nicer for most of the use cases.
This allows users to pass options to [`addEventListener`](https://developer.mozilla.org/en-US/docs/Web/API/EventTarget/addEventListener#Parameters). This is especially usefull when using passive event listeners which can greatly improve scrolling performance. See atom-minimap/minimap#683
f981874
to
6f0ac87
Compare
Marking event listeners as passive, indicates that the callback will never call `event.preventDefault()`. This can greatly improve scrolling performance. For more information on passive event listeners see: https://developers.google.com/web/updates/2016/06/passive-event-listeners⚠️ This PR requires abe33/atom-utils#3 to work correctly.
Checkout atom-minimap/minimap#684 for an example usage. |
@abe33 Friendly ping, could you take a look at this? |
Any updates on this? |
🎉 This PR is included in version 0.11.0 of atom-utils-plus 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Marking event listeners as passive, indicates that the callback will never call `event.preventDefault()`. This can greatly improve scrolling performance. For more information on passive event listeners see: https://developers.google.com/web/updates/2016/06/passive-event-listeners⚠️ This PR requires abe33/atom-utils#3 to work correctly.
Marking event listeners as passive, indicates that the callback will never call `event.preventDefault()`. This can greatly improve scrolling performance. For more information on passive event listeners see: https://developers.google.com/web/updates/2016/06/passive-event-listeners⚠️ This PR requires abe33/atom-utils#3 to work correctly.
Marking event listeners as passive, indicates that the callback will never call `event.preventDefault()`. This can greatly improve scrolling performance. For more information on passive event listeners see: https://developers.google.com/web/updates/2016/06/passive-event-listeners⚠️ This PR requires abe33/atom-utils#3 to work correctly. Co-authored-by: Lukas Geiger <lukas@plumerai.com>
This allows users to pass options to
addEventListener
. This is especially usefull when using passive event listeners which can greatly improve scrolling performance. See atom-minimap/minimap#683