react-instagram-embed
Advanced tools
Comparing version 1.1.1 to 1.1.2
@@ -36,28 +36,14 @@ 'use strict'; | ||
function InstagramEmbed(props) { | ||
_classCallCheck(this, InstagramEmbed); | ||
function InstagramEmbed() { | ||
var _ref; | ||
var _this2 = _possibleConstructorReturn(this, (InstagramEmbed.__proto__ || Object.getPrototypeOf(InstagramEmbed)).call(this, props)); | ||
var _temp, _this2, _ret; | ||
_this2.state = { __html: null }; | ||
_classCallCheck(this, InstagramEmbed); | ||
_this2.handleFetchSuccess = function (response) { | ||
_this2.props.onSuccess && _this2.props.onSuccess(response); | ||
_this2.setState({ __html: response.html }, function () { | ||
return window.instgrm.Embeds.process(); | ||
}); | ||
}; | ||
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this2.handleFetchFailure = function () { | ||
var _this2$props; | ||
clearTimeout(_this2._timer); | ||
_this2.props.onFailure && (_this2$props = _this2.props).onFailure.apply(_this2$props, arguments); | ||
}; | ||
_this2.cancel = function () { | ||
return _this2.jsonp.cancel(); | ||
}; | ||
return _this2; | ||
return _ret = (_temp = (_this2 = _possibleConstructorReturn(this, (_ref = InstagramEmbed.__proto__ || Object.getPrototypeOf(InstagramEmbed)).call.apply(_ref, [this].concat(args))), _this2), _initialiseProps.call(_this2), _temp), _possibleConstructorReturn(_this2, _ret); | ||
} | ||
@@ -164,6 +150,6 @@ | ||
key: 'getQueryParams', | ||
value: function getQueryParams(_ref) { | ||
var url = _ref.url, | ||
hideCaption = _ref.hideCaption, | ||
maxWidth = _ref.maxWidth; | ||
value: function getQueryParams(_ref2) { | ||
var url = _ref2.url, | ||
hideCaption = _ref2.hideCaption, | ||
maxWidth = _ref2.maxWidth; | ||
@@ -173,3 +159,3 @@ return _queryString2.default.stringify({ | ||
hidecaption: hideCaption, | ||
maxwidth: maxWidth >= 320 ? maxWidth : undefined, | ||
maxwidth: typeof maxWidth === 'number' && maxWidth >= 320 ? maxWidth : undefined, | ||
omitscript: true | ||
@@ -187,2 +173,27 @@ }); | ||
InstagramEmbed.defaultProps = { hideCaption: false, containerTagName: 'div' }; | ||
var _initialiseProps = function _initialiseProps() { | ||
var _this5 = this; | ||
this.state = { __html: null }; | ||
this.handleFetchSuccess = function (response) { | ||
_this5.props.onSuccess && _this5.props.onSuccess(response); | ||
_this5.setState({ __html: response.html }, function () { | ||
return window.instgrm.Embeds.process(); | ||
}); | ||
}; | ||
this.handleFetchFailure = function () { | ||
var _props4; | ||
clearTimeout(_this5._timer); | ||
_this5.props.onFailure && (_props4 = _this5.props).onFailure.apply(_props4, arguments); | ||
}; | ||
this.cancel = function () { | ||
return _this5.jsonp.cancel(); | ||
}; | ||
}; | ||
exports.default = InstagramEmbed; |
{ | ||
"name": "react-instagram-embed", | ||
"version": "1.1.1", | ||
"version": "1.1.2", | ||
"description": "React embedding Instagram posts component", | ||
@@ -18,7 +18,7 @@ "main": "lib/index.js", | ||
"precompile": "npm run clean:lib; mkdir -p lib", | ||
"compile": "babel -d lib src", | ||
"check": "npm run lint && npm run flow && npm test", | ||
"compile": "BABEL_ENV=production babel -d lib src", | ||
"check": "npm run lint && npm run type && npm test", | ||
"lint": "eslint src tests", | ||
"test": "jest", | ||
"flow": "flow", | ||
"type": "flow", | ||
"clean:build": "if [ -d build ]; then rm -rf build; fi", | ||
@@ -51,5 +51,5 @@ "favicon": "curl https://sugarshin.net/favicon.ico > build/favicon.ico", | ||
"babel-cli": "^6.18.0", | ||
"babel-core": "^6.18.0", | ||
"babel-core": "^6.18.2", | ||
"babel-eslint": "^7.1.0", | ||
"babel-jest": "^16.0.0", | ||
"babel-jest": "^17.0.2", | ||
"babel-loader": "^6.2.7", | ||
@@ -63,12 +63,12 @@ "babel-plugin-transform-class-properties": "^6.18.0", | ||
"css-loader": "^0.25.0", | ||
"eslint": "^3.9.1", | ||
"eslint": "^3.10.1", | ||
"eslint-plugin-babel": "^3.3.0", | ||
"eslint-plugin-flowtype": "^2.25.0", | ||
"eslint-plugin-react": "^6.4.1", | ||
"flow-bin": "^0.34.0", | ||
"eslint-plugin-react": "^6.7.1", | ||
"flow-bin": "^0.35.0", | ||
"gh-pages": "^0.11.0", | ||
"highlight.js": "^9.7.0", | ||
"highlight.js": "^9.8.0", | ||
"html-webpack-plugin": "^2.24.1", | ||
"insert-stylesheet": "^0.1.0", | ||
"jest": "^16.0.2", | ||
"jest": "^17.0.2", | ||
"react": "^15.3.2", | ||
@@ -75,0 +75,0 @@ "react-dom": "^15.3.2", |
12648
159