react-isomorphic-tools
Advanced tools
Comparing version 1.3.1 to 1.3.2
@@ -59,3 +59,3 @@ 'use strict'; | ||
if (!components.length) { | ||
_context.next = 17; | ||
_context.next = 18; | ||
break; | ||
@@ -69,3 +69,3 @@ } | ||
if ((_context.t1 = _context.t0()).done) { | ||
_context.next = 16; | ||
_context.next = 17; | ||
break; | ||
@@ -77,3 +77,3 @@ } | ||
if (!components.hasOwnProperty(i)) { | ||
_context.next = 14; | ||
_context.next = 15; | ||
break; | ||
@@ -106,3 +106,8 @@ } | ||
case 11: | ||
_context.next = 13; | ||
if (!component.hasOwnProperty('preload')) { | ||
_context.next = 14; | ||
break; | ||
} | ||
_context.next = 14; | ||
return component.preload({ | ||
@@ -121,3 +126,3 @@ getState: getState, | ||
case 13: | ||
case 14: | ||
dispatch((0, _preload.push)({ | ||
@@ -129,10 +134,10 @@ displayName: component.displayName, | ||
case 14: | ||
case 15: | ||
_context.next = 4; | ||
break; | ||
case 16: | ||
case 17: | ||
dispatch((0, _preload.finish)()); | ||
case 17: | ||
case 18: | ||
case 'end': | ||
@@ -139,0 +144,0 @@ return _context.stop(); |
{ | ||
"name": "react-isomorphic-tools", | ||
"version": "1.3.1", | ||
"version": "1.3.2", | ||
"description": "Authorization, Fetcher, Preload. Tools for ServerSide rendering", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -8,22 +8,2 @@ 'use strict'; | ||
var _getPrototypeOf = require('babel-runtime/core-js/object/get-prototype-of'); | ||
var _getPrototypeOf2 = _interopRequireDefault(_getPrototypeOf); | ||
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck'); | ||
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2); | ||
var _createClass2 = require('babel-runtime/helpers/createClass'); | ||
var _createClass3 = _interopRequireDefault(_createClass2); | ||
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn'); | ||
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2); | ||
var _inherits2 = require('babel-runtime/helpers/inherits'); | ||
var _inherits3 = _interopRequireDefault(_inherits2); | ||
var _react = require('react'); | ||
@@ -42,20 +22,7 @@ | ||
return function (Component) { | ||
var _class, _temp; | ||
Component.displayName = 'Preload(' + (0, _reactDisplayName2.default)(Component) + ')'; | ||
Component.preload = _preload; | ||
Component.preloadOptions = options; | ||
return _temp = _class = function (_React$Component) { | ||
(0, _inherits3.default)(Preload, _React$Component); | ||
function Preload() { | ||
(0, _classCallCheck3.default)(this, Preload); | ||
return (0, _possibleConstructorReturn3.default)(this, (Preload.__proto__ || (0, _getPrototypeOf2.default)(Preload)).apply(this, arguments)); | ||
} | ||
(0, _createClass3.default)(Preload, [{ | ||
key: 'render', | ||
value: function render() { | ||
return _react2.default.createElement(Component, this.props); | ||
} | ||
}]); | ||
return Preload; | ||
}(_react2.default.Component), _class.displayName = 'Preload(' + (0, _reactDisplayName2.default)(Component) + ')', _class.preload = _preload, _class.preloadOptions = options, _temp; | ||
return Component; | ||
}; | ||
@@ -66,20 +33,6 @@ }; | ||
return function (Component) { | ||
var _class2, _temp2; | ||
Component.displayName = 'OnEnter(' + (0, _reactDisplayName2.default)(Component) + ')'; | ||
Component.onEnter = _onEnter; | ||
return _temp2 = _class2 = function (_React$Component2) { | ||
(0, _inherits3.default)(OnEnter, _React$Component2); | ||
function OnEnter() { | ||
(0, _classCallCheck3.default)(this, OnEnter); | ||
return (0, _possibleConstructorReturn3.default)(this, (OnEnter.__proto__ || (0, _getPrototypeOf2.default)(OnEnter)).apply(this, arguments)); | ||
} | ||
(0, _createClass3.default)(OnEnter, [{ | ||
key: 'render', | ||
value: function render() { | ||
return _react2.default.createElement(Component, this.props); | ||
} | ||
}]); | ||
return OnEnter; | ||
}(_react2.default.Component), _class2.displayName = 'OnEnter(' + (0, _reactDisplayName2.default)(Component) + ')', _class2.onEnter = _onEnter, _temp2; | ||
return Component; | ||
}; | ||
@@ -86,0 +39,0 @@ }; |
@@ -35,12 +35,14 @@ import lodash from 'lodash' | ||
} | ||
await component.preload({ | ||
getState, | ||
dispatch, | ||
routes, | ||
params, | ||
location, | ||
router, | ||
fetcher, | ||
fetchToState: (url, params) => dispatch(fetchToState(url, params)), | ||
}, props) | ||
if(component.hasOwnProperty('preload')){ | ||
await component.preload({ | ||
getState, | ||
dispatch, | ||
routes, | ||
params, | ||
location, | ||
router, | ||
fetcher, | ||
fetchToState: (url, params) => dispatch(fetchToState(url, params)), | ||
}, props) | ||
} | ||
dispatch(push({ | ||
@@ -47,0 +49,0 @@ displayName: component.displayName, |
import React from 'react' | ||
import getDisplayName from 'react-display-name' | ||
const preload = (preload, options = {}) => Component => class Preload extends React.Component { | ||
static displayName = `Preload(${getDisplayName(Component)})` | ||
static preload = preload | ||
static preloadOptions = options | ||
const preload = (preload, options = {}) => Component => { | ||
Component.displayName = `Preload(${getDisplayName(Component)})` | ||
Component.preload = preload | ||
Component.preloadOptions = options | ||
render() { | ||
return <Component {...this.props}/> | ||
} | ||
return Component | ||
} | ||
const onEnter = (onEnter) => Component => class OnEnter extends React.Component { | ||
static displayName = `OnEnter(${getDisplayName(Component)})` | ||
static onEnter = onEnter | ||
render() { | ||
return <Component {...this.props}/> | ||
} | ||
const onEnter = (onEnter) => Component => { | ||
Component.displayName = `OnEnter(${getDisplayName(Component)})` | ||
Component.onEnter = onEnter | ||
return Component | ||
} | ||
@@ -22,0 +19,0 @@ |
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
149500
1956