react-esc-resolver
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -39,3 +39,3 @@ 'use strict'; | ||
return function (Component) { | ||
var _class, _temp, _initialiseProps; | ||
var _class, _temp; | ||
@@ -50,9 +50,24 @@ return _temp = _class = function (_React$Component) { | ||
_initialiseProps.call(_this); | ||
_this.enqueue = function (promise) { | ||
_this.queue.push(promise); | ||
return promise; | ||
}; | ||
_this.isLoaded = function () { | ||
var loaded = true; | ||
loadProps.forEach(function (prop) { | ||
if (!(0, _utils.hasOwnProperty)(_this.props, prop) || !_this.props[prop]) { | ||
loaded = false; | ||
} | ||
}); | ||
return loaded; | ||
}; | ||
_this.queue = []; | ||
_this.state = { | ||
bypass: process.env.NODE_ENV === 'test', | ||
loaded: _this.isLoaded(props), | ||
server: isServer | ||
bypass: isServer || process.env.NODE_ENV === 'test', | ||
loaded: _this.isLoaded(props) | ||
}; | ||
@@ -65,11 +80,3 @@ return _this; | ||
value: function componentDidMount() { | ||
var _this2 = this; | ||
this.setState({ server: false }, function () { | ||
if (!_this2.isLoaded(_this2.props)) { | ||
Promise.all(_this2.queue).then(function () { | ||
return _this2.setState({ loaded: true }); | ||
}); | ||
} | ||
}); | ||
this.setState({ server: false }); | ||
} | ||
@@ -79,11 +86,8 @@ }, { | ||
value: function render() { | ||
var _this3 = this; | ||
var _this2 = this; | ||
var _state = this.state, | ||
bypass = _state.bypass, | ||
loaded = _state.loaded, | ||
server = _state.server; | ||
var bypass = this.state.bypass; | ||
if (bypass || loaded || server) { | ||
if (bypass || this.isLoaded()) { | ||
return _react2.default.createElement(Component, this.props); | ||
@@ -103,3 +107,3 @@ } | ||
function (resolved) { | ||
return _react2.default.createElement(Component, _extends({}, _this3.props, resolved)); | ||
return _react2.default.createElement(Component, _extends({}, _this2.props, resolved)); | ||
} | ||
@@ -117,24 +121,4 @@ ) | ||
resolver: _propTypes2.default.instanceOf(_Resolver2.default) | ||
}, _initialiseProps = function () { | ||
var _this4 = this; | ||
this.enqueue = function (promise) { | ||
_this4.queue.push(promise); | ||
return promise; | ||
}; | ||
this.isLoaded = function (props) { | ||
var loaded = true; | ||
loadProps.forEach(function (prop) { | ||
if (!(0, _utils.hasOwnProperty)(props, prop) || !props[prop]) { | ||
loaded = false; | ||
} | ||
}); | ||
return loaded; | ||
}; | ||
}, _temp; | ||
}; | ||
}; |
{ | ||
"name": "react-esc-resolver", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"description": "Easy to use Client and Server Resolver", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26136
437