Skip to content

Commit 9850bec

Browse files
aminyalgeiger
andcommitted
fix: Mark atom-utils event listeners as passive
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 <[email protected]>
1 parent a954c3f commit 9850bec

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/minimap-element.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ class MinimapElement {
498498
this.subscriptions.add(this.subscribeTo(this.getFrontCanvas(), {
499499
mousedown: (e) => { this.canvasPressed(this.extractMouseEventData(e)) },
500500
touchstart: (e) => { this.canvasPressed(this.extractTouchEventData(e)) }
501-
}))
501+
}, { passive: true }))
502502
}
503503

504504
/**
@@ -515,7 +515,7 @@ class MinimapElement {
515515
this.visibleAreaSubscription = this.subscribeTo(this.visibleArea, {
516516
mousedown: (e) => { this.startDrag(this.extractMouseEventData(e)) },
517517
touchstart: (e) => { this.startDrag(this.extractTouchEventData(e)) }
518-
})
518+
}, { passive: true })
519519

520520
this.subscriptions.add(this.visibleAreaSubscription)
521521
}

lib/minimap-quick-settings-element.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class MinimapQuickSettingsElement {
117117

118118
subs.add(this.subscribeTo(this.hiddenInput, {
119119
focusout: (e) => { this.destroy() }
120-
}))
120+
}, { passive: true }))
121121

122122
subs.add(this.subscribeTo(this.onLeftButton, {
123123
mousedown: (e) => {

0 commit comments

Comments
 (0)