Comparing version 2.6.0-beta.22 to 2.6.0-beta.23
import _toConsumableArray from '@babel/runtime/helpers/esm/toConsumableArray'; | ||
import _objectSpread from '@babel/runtime/helpers/esm/objectSpread'; | ||
import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2'; | ||
import _classCallCheck from '@babel/runtime/helpers/esm/classCallCheck'; | ||
import _createClass from '@babel/runtime/helpers/esm/createClass'; | ||
import _possibleConstructorReturn from '@babel/runtime/helpers/esm/possibleConstructorReturn'; | ||
import _getPrototypeOf from '@babel/runtime/helpers/esm/getPrototypeOf'; | ||
import _inherits from '@babel/runtime/helpers/esm/inherits'; | ||
import _createSuper from '@babel/runtime/helpers/esm/createSuper'; | ||
import React, { Component } from 'react'; | ||
@@ -27,69 +26,66 @@ | ||
var resolve = config.resolve; | ||
return ( | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
_inherits(DynamicComponent, _Component); | ||
return /*#__PURE__*/function (_Component) { | ||
_inherits(DynamicComponent, _Component); | ||
function DynamicComponent() { | ||
var _getPrototypeOf2; | ||
var _super = _createSuper(DynamicComponent); | ||
var _this; | ||
function DynamicComponent() { | ||
var _this; | ||
_classCallCheck(this, DynamicComponent); | ||
_classCallCheck(this, DynamicComponent); | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(DynamicComponent)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_this.LoadingComponent = config.LoadingComponent || defaultLoadingComponent; | ||
_this.state = { | ||
AsyncComponent: null | ||
}; | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
_this.LoadingComponent = config.LoadingComponent || defaultLoadingComponent; | ||
_this.state = { | ||
AsyncComponent: null | ||
}; | ||
_this.load(); | ||
_this.load(); | ||
return _this; | ||
return _this; | ||
} | ||
_createClass(DynamicComponent, [{ | ||
key: "componentDidMount", | ||
value: function componentDidMount() { | ||
this.mounted = true; | ||
} | ||
}, { | ||
key: "componentWillUnmount", | ||
value: function componentWillUnmount() { | ||
this.mounted = false; | ||
} | ||
}, { | ||
key: "load", | ||
value: function load() { | ||
var _this2 = this; | ||
_createClass(DynamicComponent, [{ | ||
key: "componentDidMount", | ||
value: function componentDidMount() { | ||
this.mounted = true; | ||
} | ||
}, { | ||
key: "componentWillUnmount", | ||
value: function componentWillUnmount() { | ||
this.mounted = false; | ||
} | ||
}, { | ||
key: "load", | ||
value: function load() { | ||
var _this2 = this; | ||
resolve().then(function (m) { | ||
var AsyncComponent = m.default || m; | ||
resolve().then(function (m) { | ||
var AsyncComponent = m.default || m; | ||
if (_this2.mounted) { | ||
_this2.setState({ | ||
AsyncComponent: AsyncComponent | ||
}); | ||
} else { | ||
_this2.state.AsyncComponent = AsyncComponent; // eslint-disable-line | ||
} | ||
}); | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
var AsyncComponent = this.state.AsyncComponent; | ||
var LoadingComponent = this.LoadingComponent; | ||
if (AsyncComponent) return /*#__PURE__*/React.createElement(AsyncComponent, this.props); | ||
return /*#__PURE__*/React.createElement(LoadingComponent, this.props); | ||
} | ||
}]); | ||
if (_this2.mounted) { | ||
_this2.setState({ | ||
AsyncComponent: AsyncComponent | ||
}); | ||
} else { | ||
_this2.state.AsyncComponent = AsyncComponent; // eslint-disable-line | ||
} | ||
}); | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
var AsyncComponent = this.state.AsyncComponent; | ||
var LoadingComponent = this.LoadingComponent; | ||
if (AsyncComponent) return React.createElement(AsyncComponent, this.props); | ||
return React.createElement(LoadingComponent, this.props); | ||
} | ||
}]); | ||
return DynamicComponent; | ||
}(Component) | ||
); | ||
return DynamicComponent; | ||
}(Component); | ||
} | ||
@@ -96,0 +92,0 @@ |
@@ -45,16 +45,31 @@ 'use strict'; | ||
function _objectSpread(target) { | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
if (enumerableOnly) symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _objectSpread2(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
var ownKeys = Object.keys(source); | ||
if (typeof Object.getOwnPropertySymbols === 'function') { | ||
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(source, sym).enumerable; | ||
})); | ||
if (i % 2) { | ||
ownKeys(Object(source), true).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} else if (Object.getOwnPropertyDescriptors) { | ||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); | ||
} else { | ||
ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
ownKeys.forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} | ||
@@ -96,2 +111,15 @@ | ||
function _isNativeReflectConstruct() { | ||
if (typeof Reflect === "undefined" || !Reflect.construct) return false; | ||
if (Reflect.construct.sham) return false; | ||
if (typeof Proxy === "function") return true; | ||
try { | ||
Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); | ||
return true; | ||
} catch (e) { | ||
return false; | ||
} | ||
} | ||
function _assertThisInitialized(self) { | ||
@@ -113,20 +141,52 @@ if (self === void 0) { | ||
function _createSuper(Derived) { | ||
var hasNativeReflectConstruct = _isNativeReflectConstruct(); | ||
return function _createSuperInternal() { | ||
var Super = _getPrototypeOf(Derived), | ||
result; | ||
if (hasNativeReflectConstruct) { | ||
var NewTarget = _getPrototypeOf(this).constructor; | ||
result = Reflect.construct(Super, arguments, NewTarget); | ||
} else { | ||
result = Super.apply(this, arguments); | ||
} | ||
return _possibleConstructorReturn(this, result); | ||
}; | ||
} | ||
function _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
if (Array.isArray(arr)) return _arrayLikeToArray(arr); | ||
} | ||
function _iterableToArray(iter) { | ||
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); | ||
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); | ||
} | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _nonIterableSpread() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance"); | ||
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
@@ -151,69 +211,66 @@ | ||
var resolve = config.resolve; | ||
return ( | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
_inherits(DynamicComponent, _Component); | ||
return /*#__PURE__*/function (_Component) { | ||
_inherits(DynamicComponent, _Component); | ||
function DynamicComponent() { | ||
var _getPrototypeOf2; | ||
var _super = _createSuper(DynamicComponent); | ||
var _this; | ||
function DynamicComponent() { | ||
var _this; | ||
_classCallCheck(this, DynamicComponent); | ||
_classCallCheck(this, DynamicComponent); | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(DynamicComponent)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_this.LoadingComponent = config.LoadingComponent || defaultLoadingComponent; | ||
_this.state = { | ||
AsyncComponent: null | ||
}; | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
_this.LoadingComponent = config.LoadingComponent || defaultLoadingComponent; | ||
_this.state = { | ||
AsyncComponent: null | ||
}; | ||
_this.load(); | ||
_this.load(); | ||
return _this; | ||
return _this; | ||
} | ||
_createClass(DynamicComponent, [{ | ||
key: "componentDidMount", | ||
value: function componentDidMount() { | ||
this.mounted = true; | ||
} | ||
}, { | ||
key: "componentWillUnmount", | ||
value: function componentWillUnmount() { | ||
this.mounted = false; | ||
} | ||
}, { | ||
key: "load", | ||
value: function load() { | ||
var _this2 = this; | ||
_createClass(DynamicComponent, [{ | ||
key: "componentDidMount", | ||
value: function componentDidMount() { | ||
this.mounted = true; | ||
} | ||
}, { | ||
key: "componentWillUnmount", | ||
value: function componentWillUnmount() { | ||
this.mounted = false; | ||
} | ||
}, { | ||
key: "load", | ||
value: function load() { | ||
var _this2 = this; | ||
resolve().then(function (m) { | ||
var AsyncComponent = m.default || m; | ||
resolve().then(function (m) { | ||
var AsyncComponent = m.default || m; | ||
if (_this2.mounted) { | ||
_this2.setState({ | ||
AsyncComponent: AsyncComponent | ||
}); | ||
} else { | ||
_this2.state.AsyncComponent = AsyncComponent; // eslint-disable-line | ||
} | ||
}); | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
var AsyncComponent = this.state.AsyncComponent; | ||
var LoadingComponent = this.LoadingComponent; | ||
if (AsyncComponent) return /*#__PURE__*/React__default.createElement(AsyncComponent, this.props); | ||
return /*#__PURE__*/React__default.createElement(LoadingComponent, this.props); | ||
} | ||
}]); | ||
if (_this2.mounted) { | ||
_this2.setState({ | ||
AsyncComponent: AsyncComponent | ||
}); | ||
} else { | ||
_this2.state.AsyncComponent = AsyncComponent; // eslint-disable-line | ||
} | ||
}); | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
var AsyncComponent = this.state.AsyncComponent; | ||
var LoadingComponent = this.LoadingComponent; | ||
if (AsyncComponent) return React__default.createElement(AsyncComponent, this.props); | ||
return React__default.createElement(LoadingComponent, this.props); | ||
} | ||
}]); | ||
return DynamicComponent; | ||
}(React.Component) | ||
); | ||
return DynamicComponent; | ||
}(React.Component); | ||
} | ||
@@ -225,3 +282,3 @@ | ||
resolveComponent = config.component; | ||
return asyncComponent(_objectSpread({ | ||
return asyncComponent(_objectSpread2({ | ||
resolve: config.resolve || function () { | ||
@@ -228,0 +285,0 @@ var models = typeof resolveModels === 'function' ? resolveModels() : []; |
@@ -1,2 +0,2 @@ | ||
import _objectSpread from '@babel/runtime/helpers/esm/objectSpread'; | ||
import _objectSpread from '@babel/runtime/helpers/esm/objectSpread2'; | ||
import _typeof from '@babel/runtime/helpers/esm/typeof'; | ||
@@ -23,5 +23,4 @@ import _toConsumableArray from '@babel/runtime/helpers/esm/toConsumableArray'; | ||
import _createClass from '@babel/runtime/helpers/esm/createClass'; | ||
import _possibleConstructorReturn from '@babel/runtime/helpers/esm/possibleConstructorReturn'; | ||
import _getPrototypeOf from '@babel/runtime/helpers/esm/getPrototypeOf'; | ||
import _inherits from '@babel/runtime/helpers/esm/inherits'; | ||
import _createSuper from '@babel/runtime/helpers/esm/createSuper'; | ||
@@ -45,69 +44,66 @@ var cached = {}; | ||
var resolve = config.resolve; | ||
return ( | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
_inherits(DynamicComponent, _Component); | ||
return /*#__PURE__*/function (_Component) { | ||
_inherits(DynamicComponent, _Component); | ||
function DynamicComponent() { | ||
var _getPrototypeOf2; | ||
var _super = _createSuper(DynamicComponent); | ||
var _this; | ||
function DynamicComponent() { | ||
var _this; | ||
_classCallCheck(this, DynamicComponent); | ||
_classCallCheck(this, DynamicComponent); | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(DynamicComponent)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_this.LoadingComponent = config.LoadingComponent || defaultLoadingComponent; | ||
_this.state = { | ||
AsyncComponent: null | ||
}; | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
_this.LoadingComponent = config.LoadingComponent || defaultLoadingComponent; | ||
_this.state = { | ||
AsyncComponent: null | ||
}; | ||
_this.load(); | ||
_this.load(); | ||
return _this; | ||
return _this; | ||
} | ||
_createClass(DynamicComponent, [{ | ||
key: "componentDidMount", | ||
value: function componentDidMount() { | ||
this.mounted = true; | ||
} | ||
}, { | ||
key: "componentWillUnmount", | ||
value: function componentWillUnmount() { | ||
this.mounted = false; | ||
} | ||
}, { | ||
key: "load", | ||
value: function load() { | ||
var _this2 = this; | ||
_createClass(DynamicComponent, [{ | ||
key: "componentDidMount", | ||
value: function componentDidMount() { | ||
this.mounted = true; | ||
} | ||
}, { | ||
key: "componentWillUnmount", | ||
value: function componentWillUnmount() { | ||
this.mounted = false; | ||
} | ||
}, { | ||
key: "load", | ||
value: function load() { | ||
var _this2 = this; | ||
resolve().then(function (m) { | ||
var AsyncComponent = m.default || m; | ||
resolve().then(function (m) { | ||
var AsyncComponent = m.default || m; | ||
if (_this2.mounted) { | ||
_this2.setState({ | ||
AsyncComponent: AsyncComponent | ||
}); | ||
} else { | ||
_this2.state.AsyncComponent = AsyncComponent; // eslint-disable-line | ||
} | ||
}); | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
var AsyncComponent = this.state.AsyncComponent; | ||
var LoadingComponent = this.LoadingComponent; | ||
if (AsyncComponent) return /*#__PURE__*/React.createElement(AsyncComponent, this.props); | ||
return /*#__PURE__*/React.createElement(LoadingComponent, this.props); | ||
} | ||
}]); | ||
if (_this2.mounted) { | ||
_this2.setState({ | ||
AsyncComponent: AsyncComponent | ||
}); | ||
} else { | ||
_this2.state.AsyncComponent = AsyncComponent; // eslint-disable-line | ||
} | ||
}); | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
var AsyncComponent = this.state.AsyncComponent; | ||
var LoadingComponent = this.LoadingComponent; | ||
if (AsyncComponent) return React.createElement(AsyncComponent, this.props); | ||
return React.createElement(LoadingComponent, this.props); | ||
} | ||
}]); | ||
return DynamicComponent; | ||
}(Component) | ||
); | ||
return DynamicComponent; | ||
}(Component); | ||
} | ||
@@ -225,3 +221,3 @@ | ||
var DvaRoot = function DvaRoot(extraProps) { | ||
return React.createElement(Provider, { | ||
return /*#__PURE__*/React.createElement(Provider, { | ||
store: store | ||
@@ -259,4 +255,8 @@ }, router(_objectSpread({ | ||
var cbStr = callback.toString(); | ||
var isConnectedRouterHandler = callback.name === 'handleLocationChange' && cbStr.indexOf('onLocationChanged') > -1 || cbStr.indexOf('.inTimeTravelling') > -1 && cbStr.indexOf('.inTimeTravelling') > -1 && cbStr.indexOf('arguments[2]') > -1; | ||
callback(history.location, history.action); | ||
var isConnectedRouterHandler = callback.name === 'handleLocationChange' && cbStr.indexOf('onLocationChanged') > -1 || cbStr.indexOf('.inTimeTravelling') > -1 && cbStr.indexOf('.inTimeTravelling') > -1 && cbStr.indexOf('arguments[2]') > -1; // why add __isDvaPatch: true | ||
// since it's a patch from dva, we need to identify it in the listen handlers | ||
callback(history.location, history.action, { | ||
__isDvaPatch: true | ||
}); | ||
return oldListen.call(history, function () { | ||
@@ -263,0 +263,0 @@ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { |
@@ -20,2 +20,4 @@ 'use strict'; | ||
function _typeof(obj) { | ||
"@babel/helpers - typeof"; | ||
if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { | ||
@@ -71,16 +73,31 @@ _typeof = function (obj) { | ||
function _objectSpread(target) { | ||
function ownKeys(object, enumerableOnly) { | ||
var keys = Object.keys(object); | ||
if (Object.getOwnPropertySymbols) { | ||
var symbols = Object.getOwnPropertySymbols(object); | ||
if (enumerableOnly) symbols = symbols.filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(object, sym).enumerable; | ||
}); | ||
keys.push.apply(keys, symbols); | ||
} | ||
return keys; | ||
} | ||
function _objectSpread2(target) { | ||
for (var i = 1; i < arguments.length; i++) { | ||
var source = arguments[i] != null ? arguments[i] : {}; | ||
var ownKeys = Object.keys(source); | ||
if (typeof Object.getOwnPropertySymbols === 'function') { | ||
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { | ||
return Object.getOwnPropertyDescriptor(source, sym).enumerable; | ||
})); | ||
if (i % 2) { | ||
ownKeys(Object(source), true).forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} else if (Object.getOwnPropertyDescriptors) { | ||
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); | ||
} else { | ||
ownKeys(Object(source)).forEach(function (key) { | ||
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); | ||
}); | ||
} | ||
ownKeys.forEach(function (key) { | ||
_defineProperty(target, key, source[key]); | ||
}); | ||
} | ||
@@ -122,2 +139,15 @@ | ||
function _isNativeReflectConstruct() { | ||
if (typeof Reflect === "undefined" || !Reflect.construct) return false; | ||
if (Reflect.construct.sham) return false; | ||
if (typeof Proxy === "function") return true; | ||
try { | ||
Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); | ||
return true; | ||
} catch (e) { | ||
return false; | ||
} | ||
} | ||
function _assertThisInitialized(self) { | ||
@@ -139,20 +169,52 @@ if (self === void 0) { | ||
function _createSuper(Derived) { | ||
var hasNativeReflectConstruct = _isNativeReflectConstruct(); | ||
return function _createSuperInternal() { | ||
var Super = _getPrototypeOf(Derived), | ||
result; | ||
if (hasNativeReflectConstruct) { | ||
var NewTarget = _getPrototypeOf(this).constructor; | ||
result = Reflect.construct(Super, arguments, NewTarget); | ||
} else { | ||
result = Super.apply(this, arguments); | ||
} | ||
return _possibleConstructorReturn(this, result); | ||
}; | ||
} | ||
function _toConsumableArray(arr) { | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); | ||
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); | ||
} | ||
function _arrayWithoutHoles(arr) { | ||
if (Array.isArray(arr)) { | ||
for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
if (Array.isArray(arr)) return _arrayLikeToArray(arr); | ||
} | ||
function _iterableToArray(iter) { | ||
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); | ||
if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); | ||
} | ||
function _unsupportedIterableToArray(o, minLen) { | ||
if (!o) return; | ||
if (typeof o === "string") return _arrayLikeToArray(o, minLen); | ||
var n = Object.prototype.toString.call(o).slice(8, -1); | ||
if (n === "Object" && o.constructor) n = o.constructor.name; | ||
if (n === "Map" || n === "Set") return Array.from(o); | ||
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); | ||
} | ||
function _arrayLikeToArray(arr, len) { | ||
if (len == null || len > arr.length) len = arr.length; | ||
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; | ||
return arr2; | ||
} | ||
function _nonIterableSpread() { | ||
throw new TypeError("Invalid attempt to spread non-iterable instance"); | ||
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); | ||
} | ||
@@ -177,69 +239,66 @@ | ||
var resolve = config.resolve; | ||
return ( | ||
/*#__PURE__*/ | ||
function (_Component) { | ||
_inherits(DynamicComponent, _Component); | ||
return /*#__PURE__*/function (_Component) { | ||
_inherits(DynamicComponent, _Component); | ||
function DynamicComponent() { | ||
var _getPrototypeOf2; | ||
var _super = _createSuper(DynamicComponent); | ||
var _this; | ||
function DynamicComponent() { | ||
var _this; | ||
_classCallCheck(this, DynamicComponent); | ||
_classCallCheck(this, DynamicComponent); | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { | ||
args[_key] = arguments[_key]; | ||
} | ||
_this = _possibleConstructorReturn(this, (_getPrototypeOf2 = _getPrototypeOf(DynamicComponent)).call.apply(_getPrototypeOf2, [this].concat(args))); | ||
_this.LoadingComponent = config.LoadingComponent || defaultLoadingComponent; | ||
_this.state = { | ||
AsyncComponent: null | ||
}; | ||
_this = _super.call.apply(_super, [this].concat(args)); | ||
_this.LoadingComponent = config.LoadingComponent || defaultLoadingComponent; | ||
_this.state = { | ||
AsyncComponent: null | ||
}; | ||
_this.load(); | ||
_this.load(); | ||
return _this; | ||
return _this; | ||
} | ||
_createClass(DynamicComponent, [{ | ||
key: "componentDidMount", | ||
value: function componentDidMount() { | ||
this.mounted = true; | ||
} | ||
}, { | ||
key: "componentWillUnmount", | ||
value: function componentWillUnmount() { | ||
this.mounted = false; | ||
} | ||
}, { | ||
key: "load", | ||
value: function load() { | ||
var _this2 = this; | ||
_createClass(DynamicComponent, [{ | ||
key: "componentDidMount", | ||
value: function componentDidMount() { | ||
this.mounted = true; | ||
} | ||
}, { | ||
key: "componentWillUnmount", | ||
value: function componentWillUnmount() { | ||
this.mounted = false; | ||
} | ||
}, { | ||
key: "load", | ||
value: function load() { | ||
var _this2 = this; | ||
resolve().then(function (m) { | ||
var AsyncComponent = m.default || m; | ||
resolve().then(function (m) { | ||
var AsyncComponent = m.default || m; | ||
if (_this2.mounted) { | ||
_this2.setState({ | ||
AsyncComponent: AsyncComponent | ||
}); | ||
} else { | ||
_this2.state.AsyncComponent = AsyncComponent; // eslint-disable-line | ||
} | ||
}); | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
var AsyncComponent = this.state.AsyncComponent; | ||
var LoadingComponent = this.LoadingComponent; | ||
if (AsyncComponent) return /*#__PURE__*/React__default.createElement(AsyncComponent, this.props); | ||
return /*#__PURE__*/React__default.createElement(LoadingComponent, this.props); | ||
} | ||
}]); | ||
if (_this2.mounted) { | ||
_this2.setState({ | ||
AsyncComponent: AsyncComponent | ||
}); | ||
} else { | ||
_this2.state.AsyncComponent = AsyncComponent; // eslint-disable-line | ||
} | ||
}); | ||
} | ||
}, { | ||
key: "render", | ||
value: function render() { | ||
var AsyncComponent = this.state.AsyncComponent; | ||
var LoadingComponent = this.LoadingComponent; | ||
if (AsyncComponent) return React__default.createElement(AsyncComponent, this.props); | ||
return React__default.createElement(LoadingComponent, this.props); | ||
} | ||
}]); | ||
return DynamicComponent; | ||
}(React.Component) | ||
); | ||
return DynamicComponent; | ||
}(React.Component); | ||
} | ||
@@ -251,3 +310,3 @@ | ||
resolveComponent = config.component; | ||
return asyncComponent(_objectSpread({ | ||
return asyncComponent(_objectSpread2({ | ||
resolve: config.resolve || function () { | ||
@@ -358,5 +417,5 @@ var models = typeof resolveModels === 'function' ? resolveModels() : []; | ||
var DvaRoot = function DvaRoot(extraProps) { | ||
return React__default.createElement(reactRedux.Provider, { | ||
return /*#__PURE__*/React__default.createElement(reactRedux.Provider, { | ||
store: store | ||
}, router(_objectSpread({ | ||
}, router(_objectSpread2({ | ||
app: app, | ||
@@ -392,4 +451,8 @@ history: app._history | ||
var cbStr = callback.toString(); | ||
var isConnectedRouterHandler = callback.name === 'handleLocationChange' && cbStr.indexOf('onLocationChanged') > -1 || cbStr.indexOf('.inTimeTravelling') > -1 && cbStr.indexOf('.inTimeTravelling') > -1 && cbStr.indexOf('arguments[2]') > -1; | ||
callback(history.location, history.action); | ||
var isConnectedRouterHandler = callback.name === 'handleLocationChange' && cbStr.indexOf('onLocationChanged') > -1 || cbStr.indexOf('.inTimeTravelling') > -1 && cbStr.indexOf('.inTimeTravelling') > -1 && cbStr.indexOf('arguments[2]') > -1; // why add __isDvaPatch: true | ||
// since it's a patch from dva, we need to identify it in the listen handlers | ||
callback(history.location, history.action, { | ||
__isDvaPatch: true | ||
}); | ||
return oldListen.call(history, function () { | ||
@@ -396,0 +459,0 @@ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { |
{ | ||
"name": "dva", | ||
"version": "2.6.0-beta.22", | ||
"version": "2.6.0-beta.23", | ||
"description": "React and redux based, lightweight and elm-style framework.", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -125,3 +125,5 @@ import React from 'react'; | ||
cbStr.indexOf('arguments[2]') > -1); | ||
callback(history.location, history.action); | ||
// why add __isDvaPatch: true | ||
// since it's a patch from dva, we need to identify it in the listen handlers | ||
callback(history.location, history.action, { __isDvaPatch: true }); | ||
return oldListen.call(history, (...args) => { | ||
@@ -128,0 +130,0 @@ if (isConnectedRouterHandler) { |
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
51111
1428