Add possibility to pass options to addEventListener#3
Open
lgeiger wants to merge 1 commit intoabe33:masterfrom
Open
Add possibility to pass options to addEventListener#3lgeiger wants to merge 1 commit intoabe33:masterfrom
lgeiger wants to merge 1 commit intoabe33:masterfrom
Conversation
lgeiger
commented
Feb 15, 2019
| unless eventsForObject[event]? | ||
| eventsForObject[event] = {} | ||
| disposablesForObject[event] = @createEventListener(object, event) | ||
| disposablesForObject[event] = @createEventListener(object, event, options) |
Author
There was a problem hiding this comment.
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
lgeiger
added a commit
to lgeiger/minimap
that referenced
this pull request
Feb 15, 2019
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.
Author
|
Checkout atom-minimap/minimap#684 for an example usage. |
Author
|
@abe33 Friendly ping, could you take a look at this? |
Author
|
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 📦🚀 |
aminya
pushed a commit
to lgeiger/minimap
that referenced
this pull request
Nov 22, 2020
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.
aminya
added a commit
to lgeiger/minimap
that referenced
this pull request
Nov 22, 2020
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.
aminya
added a commit
to lgeiger/minimap
that referenced
this pull request
Nov 22, 2020
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 file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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