Skip to content

Commit 1a06a94

Browse files
author
Tim Bielawski
committed
Add "document.removeEventListener" for passive listener test
Remove prop for passive as it is not necessary to have this as optional
1 parent 7e3b329 commit 1a06a94

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/InfiniteScroll.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export default class InfiniteScroll extends Component {
1616
threshold: PropTypes.number,
1717
useCapture: PropTypes.bool,
1818
useWindow: PropTypes.bool,
19-
passive: PropTypes.bool,
2019
};
2120

2221
static defaultProps = {
@@ -31,7 +30,6 @@ export default class InfiniteScroll extends Component {
3130
useCapture: false,
3231
loader: null,
3332
getScrollParent: null,
34-
passive: false,
3533
};
3634

3735
constructor(props) {
@@ -68,6 +66,7 @@ export default class InfiniteScroll extends Component {
6866

6967
try {
7068
document.addEventListener('test', null, testOptions);
69+
document.removeEventListener('test', null, testOptions);
7170
} catch (e) {
7271
// ignore
7372
}
@@ -80,7 +79,7 @@ export default class InfiniteScroll extends Component {
8079
if (this.isPassiveSupported()) {
8180
options = {
8281
useCapture: this.props.useCapture,
83-
passive: this.props.passive,
82+
passive: true,
8483
};
8584
}
8685
return options;
@@ -171,7 +170,7 @@ export default class InfiniteScroll extends Component {
171170
mousewheelListener(e) {
172171
// Prevents Chrome hangups
173172
// See: https://stackoverflow.com/questions/47524205/random-high-content-download-time-in-chrome/47684257#47684257
174-
if (e.deltaY === 1 && (!this.props.passive || !this.isPassiveSupported())) {
173+
if (e.deltaY === 1 && !this.isPassiveSupported()) {
175174
e.preventDefault();
176175
}
177176
}

0 commit comments

Comments
 (0)