Skip to content

Commit

Permalink
1.2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
danbovey committed Dec 24, 2018
1 parent a96b855 commit 54d7b16
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 18 deletions.
21 changes: 10 additions & 11 deletions dist/InfiniteScroll.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ var InfiniteScroll = (function(_Component) {
value: function componentWillUnmount() {
this.detachScrollListener();
this.detachMousewheelListener();
},
}
},
{
key: 'isPassiveSupported',
Expand All @@ -139,30 +139,32 @@ var InfiniteScroll = (function(_Component) {
var testOptions = {
get passive() {
passive = true;
},
}
};

try {
document.addEventListener('test', null, testOptions);
document.removeEventListener('test', null, testOptions);
} catch (e) {
// ignore
}
return passive;
},
}
},
{
key: 'eventListenerOptions',
value: function eventListenerOptions() {
var options = false;
var options = this.props.useCapture;

if (this.isPassiveSupported()) {
options = {
useCapture: this.props.useCapture,
passive: this.props.passive,
passive: true
};
}
return options;
}

// Set a defaut loader for all your `InfiniteScroll` components
},
{
Expand Down Expand Up @@ -240,12 +242,12 @@ var InfiniteScroll = (function(_Component) {
scrollEl.addEventListener(
'mousewheel',
this.mousewheelListener,
this.options ? this.options : this.props.useCapture,
this.options ? this.options : this.props.useCapture
);
scrollEl.addEventListener(
'scroll',
this.scrollListener,
this.options ? this.options : this.props.useCapture,
this.options ? this.options : this.props.useCapture
);
scrollEl.addEventListener(
'resize',
Expand All @@ -263,10 +265,7 @@ var InfiniteScroll = (function(_Component) {
value: function mousewheelListener(e) {
// Prevents Chrome hangups
// See: https://stackoverflow.com/questions/47524205/random-high-content-download-time-in-chrome/47684257#47684257
if (
e.deltaY === 1 &&
(!this.props.passive || !this.isPassiveSupported())
) {
if (e.deltaY === 1 && !this.isPassiveSupported()) {
e.preventDefault();
}
}
Expand Down
11 changes: 4 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "react-infinite-scroller",
"version": "1.2.3",
"version": "1.2.4",
"description": "Infinite scroll component for React in ES6",
"main": "index.js",
"jsnext:main": "src/InfiniteScroll.js",
Expand All @@ -9,7 +9,8 @@
"url": "git://github.com/CassetteRocks/react-infinite-scroller.git"
},
"scripts": {
"build": "mkdirp dist && babel src/InfiniteScroll.js --out-file dist/InfiniteScroll.js",
"build":
"mkdirp dist && babel src/InfiniteScroll.js --out-file dist/InfiniteScroll.js",
"prepublish": "npm run build",
"test": "nyc npm run spec",
"spec": "_mocha -R spec ./test/test_helper.js --recursive test/*_test.js",
Expand All @@ -22,11 +23,7 @@
"git add"
]
},
"keywords": [
"infinite",
"scroll",
"react"
],
"keywords": ["infinite", "scroll", "react"],
"author": "CassetteRocks",
"license": "MIT",
"bugs": {
Expand Down

0 comments on commit 54d7b16

Please sign in to comment.