@@ -129,7 +129,7 @@ var InfiniteScroll = (function(_Component) {
129
129
value : function componentWillUnmount ( ) {
130
130
this . detachScrollListener ( ) ;
131
131
this . detachMousewheelListener ( ) ;
132
- } ,
132
+ }
133
133
} ,
134
134
{
135
135
key : 'isPassiveSupported' ,
@@ -139,30 +139,32 @@ var InfiniteScroll = (function(_Component) {
139
139
var testOptions = {
140
140
get passive ( ) {
141
141
passive = true ;
142
- } ,
142
+ }
143
143
} ;
144
144
145
145
try {
146
146
document . addEventListener ( 'test' , null , testOptions ) ;
147
+ document . removeEventListener ( 'test' , null , testOptions ) ;
147
148
} catch ( e ) {
148
149
// ignore
149
150
}
150
151
return passive ;
151
- } ,
152
+ }
152
153
} ,
153
154
{
154
155
key : 'eventListenerOptions' ,
155
156
value : function eventListenerOptions ( ) {
156
- var options = false ;
157
+ var options = this . props . useCapture ;
157
158
158
159
if ( this . isPassiveSupported ( ) ) {
159
160
options = {
160
161
useCapture : this . props . useCapture ,
161
- passive : this . props . passive ,
162
+ passive : true
162
163
} ;
163
164
}
164
165
return options ;
165
166
}
167
+
166
168
// Set a defaut loader for all your `InfiniteScroll` components
167
169
} ,
168
170
{
@@ -240,12 +242,12 @@ var InfiniteScroll = (function(_Component) {
240
242
scrollEl . addEventListener (
241
243
'mousewheel' ,
242
244
this . mousewheelListener ,
243
- this . options ? this . options : this . props . useCapture ,
245
+ this . options ? this . options : this . props . useCapture
244
246
) ;
245
247
scrollEl . addEventListener (
246
248
'scroll' ,
247
249
this . scrollListener ,
248
- this . options ? this . options : this . props . useCapture ,
250
+ this . options ? this . options : this . props . useCapture
249
251
) ;
250
252
scrollEl . addEventListener (
251
253
'resize' ,
@@ -263,10 +265,7 @@ var InfiniteScroll = (function(_Component) {
263
265
value : function mousewheelListener ( e ) {
264
266
// Prevents Chrome hangups
265
267
// See: https://stackoverflow.com/questions/47524205/random-high-content-download-time-in-chrome/47684257#47684257
266
- if (
267
- e . deltaY === 1 &&
268
- ( ! this . props . passive || ! this . isPassiveSupported ( ) )
269
- ) {
268
+ if ( e . deltaY === 1 && ! this . isPassiveSupported ( ) ) {
270
269
e . preventDefault ( ) ;
271
270
}
272
271
}
0 commit comments