|
| 1 | +'use strict'; |
| 2 | + |
| 3 | +Object.defineProperty(exports, "__esModule", { |
| 4 | + value: true |
| 5 | +}); |
| 6 | + |
| 7 | +var _react = require('react'); |
| 8 | + |
| 9 | +var _react2 = _interopRequireDefault(_react); |
| 10 | + |
| 11 | +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } |
| 12 | + |
| 13 | +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } |
| 14 | + |
| 15 | +function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } |
| 16 | + |
| 17 | +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; } |
| 18 | + |
| 19 | +var Async = function (_React$Component) { |
| 20 | + _inherits(Async, _React$Component); |
| 21 | + |
| 22 | + function Async() { |
| 23 | + var _ref, |
| 24 | + _this2 = this; |
| 25 | + |
| 26 | + var _temp, _this, _ret; |
| 27 | + |
| 28 | + _classCallCheck(this, Async); |
| 29 | + |
| 30 | + for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) { |
| 31 | + args[_key] = arguments[_key]; |
| 32 | + } |
| 33 | + |
| 34 | + return _ret = (_temp = (_this = _possibleConstructorReturn(this, (_ref = Async.__proto__ || Object.getPrototypeOf(Async)).call.apply(_ref, [this].concat(args))), _this), _this.componentWillMount = function () { |
| 35 | + _this.props.load.then(function (c) { |
| 36 | + _this.C = c;_this.forceUpdate(); |
| 37 | + }); |
| 38 | + }, _this.render = function () { |
| 39 | + return _this.C ? _react2.default.createElement(_this2.C.default, null) : null; |
| 40 | + }, _temp), _possibleConstructorReturn(_this, _ret); |
| 41 | + } |
| 42 | + |
| 43 | + return Async; |
| 44 | +}(_react2.default.Component); |
| 45 | + |
| 46 | +exports.default = Async; |
| 47 | + |
| 48 | + |
| 49 | +Async.propTypes = { |
| 50 | + load: _react2.default.PropTypes.instanceOf(Promise).isRequired |
| 51 | +}; |
0 commit comments