Skip to content

Commit

Permalink
1.2.3
Browse files Browse the repository at this point in the history
  • Loading branch information
danbovey committed Dec 23, 2018
1 parent 93f2758 commit 777d63b
Show file tree
Hide file tree
Showing 8 changed files with 94 additions and 109 deletions.
31 changes: 0 additions & 31 deletions .eslintrc

This file was deleted.

28 changes: 28 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const fs = require('fs');

const prettierOptions = JSON.parse(fs.readFileSync('./.prettierrc', 'utf8'));

module.exports = {
extends: ['last', 'prettier', 'prettier/react', 'plugin:react/recommended'],
plugins: ['react', 'prettier'],
globals: {
document: true,
window: true,
describe: true,
it: true,
module: true,
exports: true,
require: true
},
rules: {
'prettier/prettier': ['error', prettierOptions],
'no-unused-vars': [
'off',
{
vars: 'all',
args: 'after-used',
ignoreRestSiblings: false
}
]
}
};
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"printWidth": 80,
"tabWidth": 2,
"useTabs": false,
"semi": true,
"singleQuote": true
}
62 changes: 31 additions & 31 deletions dist/InfiniteScroll.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use strict';

Object.defineProperty(exports, '__esModule', {
value: true,
value: true
});

var _createClass = (function() {
Expand Down Expand Up @@ -52,7 +52,7 @@ function _classCallCheck(instance, Constructor) {
function _possibleConstructorReturn(self, call) {
if (!self) {
throw new ReferenceError(
"this hasn't been initialised - super() hasn't been called",
"this hasn't been initialised - super() hasn't been called"
);
}
return call && (typeof call === 'object' || typeof call === 'function')
Expand All @@ -64,16 +64,16 @@ function _inherits(subClass, superClass) {
if (typeof superClass !== 'function' && superClass !== null) {
throw new TypeError(
'Super expression must either be null or a function, not ' +
typeof superClass,
typeof superClass
);
}
subClass.prototype = Object.create(superClass && superClass.prototype, {
constructor: {
value: subClass,
enumerable: false,
writable: true,
configurable: true,
},
configurable: true
}
});
if (superClass)
Object.setPrototypeOf
Expand All @@ -91,8 +91,8 @@ var InfiniteScroll = (function(_Component) {
this,
(InfiniteScroll.__proto__ || Object.getPrototypeOf(InfiniteScroll)).call(
this,
props,
),
props
)
);

_this.scrollListener = _this.scrollListener.bind(_this);
Expand All @@ -105,7 +105,7 @@ var InfiniteScroll = (function(_Component) {
value: function componentDidMount() {
this.pageLoaded = this.props.pageStart;
this.attachScrollListener();
},
}
},
{
key: 'componentDidUpdate',
Expand All @@ -119,22 +119,22 @@ var InfiniteScroll = (function(_Component) {
this.loadMore = false;
}
this.attachScrollListener();
},
}
},
{
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.detachScrollListener();
this.detachMousewheelListener();
},
}

// Set a defaut loader for all your `InfiniteScroll` components
},
{
key: 'setDefaultLoader',
value: function setDefaultLoader(loader) {
this.defaultLoader = loader;
},
}
},
{
key: 'detachMousewheelListener',
Expand All @@ -147,9 +147,9 @@ var InfiniteScroll = (function(_Component) {
scrollEl.removeEventListener(
'mousewheel',
this.mousewheelListener,
this.props.useCapture,
this.props.useCapture
);
},
}
},
{
key: 'detachScrollListener',
Expand All @@ -162,14 +162,14 @@ var InfiniteScroll = (function(_Component) {
scrollEl.removeEventListener(
'scroll',
this.scrollListener,
this.props.useCapture,
this.props.useCapture
);
scrollEl.removeEventListener(
'resize',
this.scrollListener,
this.props.useCapture,
this.props.useCapture
);
},
}
},
{
key: 'getParentElement',
Expand All @@ -180,13 +180,13 @@ var InfiniteScroll = (function(_Component) {
return scrollParent;
}
return el && el.parentNode;
},
}
},
{
key: 'filterProps',
value: function filterProps(props) {
return props;
},
}
},
{
key: 'attachScrollListener',
Expand All @@ -205,23 +205,23 @@ var InfiniteScroll = (function(_Component) {
scrollEl.addEventListener(
'mousewheel',
this.mousewheelListener,
this.props.useCapture,
this.props.useCapture
);
scrollEl.addEventListener(
'scroll',
this.scrollListener,
this.props.useCapture,
this.props.useCapture
);
scrollEl.addEventListener(
'resize',
this.scrollListener,
this.props.useCapture,
this.props.useCapture
);

if (this.props.initialLoad) {
this.scrollListener();
}
},
}
},
{
key: 'mousewheelListener',
Expand All @@ -231,7 +231,7 @@ var InfiniteScroll = (function(_Component) {
if (e.deltaY === 1) {
e.preventDefault();
}
},
}
},
{
key: 'scrollListener',
Expand Down Expand Up @@ -277,7 +277,7 @@ var InfiniteScroll = (function(_Component) {
this.loadMore = true;
}
}
},
}
},
{
key: 'calculateOffset',
Expand All @@ -290,7 +290,7 @@ var InfiniteScroll = (function(_Component) {
this.calculateTopPosition(el) +
(el.offsetHeight - scrollTop - window.innerHeight)
);
},
}
},
{
key: 'calculateTopPosition',
Expand All @@ -299,7 +299,7 @@ var InfiniteScroll = (function(_Component) {
return 0;
}
return el.offsetTop + this.calculateTopPosition(el.offsetParent);
},
}
},
{
key: 'render',
Expand Down Expand Up @@ -334,7 +334,7 @@ var InfiniteScroll = (function(_Component) {
'threshold',
'useCapture',
'useWindow',
'getScrollParent',
'getScrollParent'
]);

props.ref = function(node) {
Expand All @@ -357,8 +357,8 @@ var InfiniteScroll = (function(_Component) {
}
}
return _react2.default.createElement(element, props, childrenArray);
},
},
}
}
]);

return InfiniteScroll;
Expand All @@ -377,7 +377,7 @@ InfiniteScroll.propTypes = {
getScrollParent: _propTypes2.default.func,
threshold: _propTypes2.default.number,
useCapture: _propTypes2.default.bool,
useWindow: _propTypes2.default.bool,
useWindow: _propTypes2.default.bool
};
InfiniteScroll.defaultProps = {
element: 'div',
Expand All @@ -390,7 +390,7 @@ InfiniteScroll.defaultProps = {
isReverse: false,
useCapture: false,
loader: null,
getScrollParent: null,
getScrollParent: null
};
exports.default = InfiniteScroll;
module.exports = exports['default'];
Loading

0 comments on commit 777d63b

Please sign in to comment.