Skip to content

Commit 63ee3eb

Browse files
author
Davide Curletti
committed
v1.0.8
1 parent ac086c8 commit 63ee3eb

9 files changed

+376
-67
lines changed

Readme.md

+25
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,31 @@ http://realscout.github.io/redux-infinite-scroll/
1515
npm install redux-infinite-scroll --save
1616
```
1717

18+
## Importing Via AMD/CommonJS
19+
20+
##### ES6 format
21+
```javascript
22+
import ReduxInfiniteScroll from 'redux-infinite-scroll';
23+
```
24+
##### ES5 format
25+
```javascript
26+
var ReduxInfiniteScroll = require('redux-infinite-scroll');
27+
```
28+
29+
## Importing Via Script Tag
30+
If you decide to use either one of the distribution files found in `/dist`, then you can access the `ReduxInfiniteScroll` via a global variable.
31+
32+
##### ES6 format
33+
```javascript
34+
ReduxInfiniteScroll
35+
```
36+
##### ES5 format
37+
```javascript
38+
ReduxInfiniteScroll.default;
39+
```
40+
The difference is due to the `ReduxInfiniteScroll` being an ES6 module and therefore having a different export syntax than ES5.
41+
42+
1843
## Usage
1944

2045
In order to use it in your React app, simply import it and follow the example below. The component expects to receive

dev/index.html

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<head>
2+
3+
</head>
4+
<body>
5+
<script src="https://fb.me/react-15.0.1.min.js"></script>
6+
<script src="https://fb.me/react-dom-15.0.1.min.js"></script>
7+
8+
<script src="../dist/redux-infinite-scroll.js"></script>
9+
10+
11+
<script>
12+
debugger
13+
</script>
14+
</body>

dist/redux-infinite-scroll.js

+292-22
Large diffs are not rendered by default.

dist/redux-infinite-scroll.min.js

+1-22
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/ReduxInfiniteScroll.js

+11-9
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,6 @@ var _reactDom = require('react-dom');
1414

1515
var _reactDom2 = _interopRequireDefault(_reactDom);
1616

17-
var _reactImmutableProptypes = require('react-immutable-proptypes');
18-
19-
var _reactImmutableProptypes2 = _interopRequireDefault(_reactImmutableProptypes);
20-
2117
var _DOMPositionUtils = require('./Utilities/DOMPositionUtils');
2218

2319
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
@@ -28,8 +24,10 @@ function _possibleConstructorReturn(self, call) { if (!self) { throw new Referen
2824

2925
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); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
3026

31-
var ReduxInfiniteScroll = function (_Component) {
32-
_inherits(ReduxInfiniteScroll, _Component);
27+
//import ImmutablePropTypes from 'react-immutable-proptypes';
28+
29+
var ReduxInfiniteScroll = function (_React$Component) {
30+
_inherits(ReduxInfiniteScroll, _React$Component);
3331

3432
function ReduxInfiniteScroll(props) {
3533
_classCallCheck(this, ReduxInfiniteScroll);
@@ -154,7 +152,7 @@ var ReduxInfiniteScroll = function (_Component) {
154152
}]);
155153

156154
return ReduxInfiniteScroll;
157-
}(_react.Component);
155+
}(_react2.default.Component);
158156

159157
exports.default = ReduxInfiniteScroll;
160158

@@ -168,8 +166,12 @@ ReduxInfiniteScroll.propTypes = {
168166
loader: _react2.default.PropTypes.any,
169167
showLoader: _react2.default.PropTypes.bool,
170168
loadMore: _react2.default.PropTypes.func.isRequired,
171-
items: _react2.default.PropTypes.oneOfType([_reactImmutableProptypes2.default.list, _react2.default.PropTypes.array]),
172-
children: _react2.default.PropTypes.oneOfType([_reactImmutableProptypes2.default.list, _react2.default.PropTypes.array]),
169+
items: _react2.default.PropTypes.oneOfType([
170+
//ImmutablePropTypes.list,
171+
_react2.default.PropTypes.array]),
172+
children: _react2.default.PropTypes.oneOfType([
173+
//ImmutablePropTypes.list,
174+
_react2.default.PropTypes.array]),
173175
holderType: _react2.default.PropTypes.string,
174176
className: _react2.default.PropTypes.oneOfType([_react2.default.PropTypes.string, _react2.default.PropTypes.func])
175177
};

min.webpack.js

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
var webpack = require('webpack');
2+
var _ = require('lodash');
3+
var config = module.exports = require('./production.webpack.js');
4+
5+
config.output = _.merge(config.output, {
6+
filename: 'redux-infinite-scroll.min.js'
7+
});
8+
9+
config.plugins.push(
10+
new webpack.optimize.UglifyJsPlugin({minimize: true})
11+
);

package.json

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
{
22
"name": "redux-infinite-scroll",
3-
"version": "1.0.7",
3+
"version": "1.0.8",
44
"description": "React infinite scroll component designed for a Redux data-flow.",
55
"main": "lib/ReduxInfiniteScroll.js",
66
"scripts": {
77
"test": "npm run transpile && karma start karma.conf.js",
88
"test-watch": "karma start karma.conf.js --single-run=false",
99
"transpile": "babel src --out-dir lib",
10-
"build": "webpack --config production.webpack.js"
10+
"build": "webpack --config production.webpack.js",
11+
"build:min": "webpack --config min.webpack.js",
12+
"build:release": "npm run transpile && npm run build && npm run build:min"
1113
},
1214
"repository": {
1315
"type": "git",
@@ -47,13 +49,13 @@
4749
"webpack": "^1.12.9",
4850
"webpack-dev-middleware": "^1.4.0",
4951
"webpack-dev-server": "^1.10.1",
50-
"webpack-hot-middleware": "^2.6.0"
51-
},
52-
"dependencies": {
53-
"immutable": "^3.7.6",
54-
"lodash": "~3.1.0",
52+
"webpack-hot-middleware": "^2.6.0",
5553
"react": "^0.14.6",
5654
"react-dom": "^0.14.6",
5755
"react-immutable-proptypes": "^1.7.0"
56+
},
57+
"dependencies": {
58+
"immutable": "^3.7.6",
59+
"lodash": "~3.1.0"
5860
}
5961
}

production.webpack.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@ var path = require('path');
44
var config = module.exports = require('./main.webpack.js');
55

66
config.output = _.merge(config.output, {
7-
filename: 'redux-infinite-scroll.min.js'
7+
filename: 'redux-infinite-scroll.js',
8+
libraryTarget: 'umd',
9+
library: 'ReduxInfiniteScroll'
810
});
911

12+
config.externals = {
13+
'react': 'React',
14+
'react-dom': 'ReactDOM'
15+
};
16+
1017
config.module.loaders.push(
1118
{
1219
test: /\.jsx?$/,
@@ -16,6 +23,5 @@ config.module.loaders.push(
1623
);
1724

1825
config.plugins.push(
19-
new webpack.optimize.UglifyJsPlugin({minimize: true}),
2026
new webpack.optimize.OccurenceOrderPlugin()
2127
);

src/ReduxInfiniteScroll.jsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import React, { Component } from 'react';
1+
import React from 'react';
22
import ReactDOM from 'react-dom';
33

4-
import ImmutablePropTypes from 'react-immutable-proptypes';
4+
//import ImmutablePropTypes from 'react-immutable-proptypes';
55

66
import {topPosition} from './Utilities/DOMPositionUtils';
77

8-
export default class ReduxInfiniteScroll extends Component {
8+
export default class ReduxInfiniteScroll extends React.Component {
99

1010
constructor(props) {
1111
super(props);
@@ -123,11 +123,11 @@ ReduxInfiniteScroll.propTypes = {
123123
showLoader: React.PropTypes.bool,
124124
loadMore: React.PropTypes.func.isRequired,
125125
items: React.PropTypes.oneOfType([
126-
ImmutablePropTypes.list,
126+
//ImmutablePropTypes.list,
127127
React.PropTypes.array
128128
]),
129129
children: React.PropTypes.oneOfType([
130-
ImmutablePropTypes.list,
130+
//ImmutablePropTypes.list,
131131
React.PropTypes.array
132132
]),
133133
holderType: React.PropTypes.string,

0 commit comments

Comments
 (0)