Skip to content

Commit 0d935b8

Browse files
Andaristprichodko
authored andcommitted
Always try to use passive event listener (#2)
* Always try to use passive event listener * Remove mentioning passive option from README
1 parent 2461a26 commit 0d935b8

File tree

2 files changed

+1
-3
lines changed

2 files changed

+1
-3
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ function MyComponent() {
2222
// optionally you can pass options, those are default:
2323
let options = {
2424
throttle: 100,
25-
passive: true,
2625
}
2726
let position = useWindowScrollPosition(options)
2827
// position == { x: 0, y: 0 }

index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ let getPosition = () => ({
2020

2121
let defaultOptions = {
2222
throttle: 100,
23-
passive: true,
2423
}
2524

2625
function useWindowScrollPosition(options) {
@@ -36,7 +35,7 @@ function useWindowScrollPosition(options) {
3635
window.addEventListener(
3736
'scroll',
3837
handleScroll,
39-
supportsPassive && opts.passive ? { passive: true } : false
38+
supportsPassive ? { passive: true } : false
4039
)
4140

4241
return () => {

0 commit comments

Comments
 (0)