Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-router-redux

Package Overview
Dependencies
Maintainers
4
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-router-redux - npm Package Compare versions

Comparing version 5.0.0-alpha.3 to 5.0.0-alpha.4

45

ConnectedRouter.js

@@ -5,4 +5,2 @@ 'use strict';

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _react = require('react');

@@ -18,4 +16,2 @@

function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -31,30 +27,35 @@

function ConnectedRouter() {
var _temp, _this, _ret;
_classCallCheck(this, ConnectedRouter);
return _possibleConstructorReturn(this, _Component.apply(this, arguments));
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.handleLocationChange = function (location) {
_this.store.dispatch({
type: _reducer.LOCATION_CHANGE,
payload: location
});
}, _temp), _possibleConstructorReturn(_this, _ret);
}
ConnectedRouter.prototype.render = function render() {
ConnectedRouter.prototype.componentWillMount = function componentWillMount() {
var _props = this.props,
propsStore = _props.store,
history = _props.history,
children = _props.children,
props = _objectWithoutProperties(_props, ['store', 'history', 'children']);
history = _props.history;
var store = propsStore || this.context.store;
this.store = propsStore || this.context.store;
return _react2.default.createElement(
_reactRouter.Router,
_extends({}, props, { history: history }),
_react2.default.createElement(_reactRouter.Route, { render: function render(_ref) {
var location = _ref.location;
this.unsubscribeFromHistory = history.listen(this.handleLocationChange);
this.handleLocationChange(history.location);
};
store.dispatch({
type: _reducer.LOCATION_CHANGE,
payload: location
});
ConnectedRouter.prototype.componentWillUnmount = function componentWillUnmount() {
if (this.unsubscribeFromHistory) this.unsubscribeFromHistory();
};
return children;
} })
);
ConnectedRouter.prototype.render = function render() {
return _react2.default.createElement(_reactRouter.Router, this.props);
};

@@ -61,0 +62,0 @@

@@ -1,5 +0,1 @@

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -12,3 +8,3 @@

import React, { Component, PropTypes } from 'react';
import { Router, Route } from 'react-router';
import { Router } from 'react-router';

@@ -21,30 +17,35 @@ import { LOCATION_CHANGE } from './reducer';

function ConnectedRouter() {
var _temp, _this, _ret;
_classCallCheck(this, ConnectedRouter);
return _possibleConstructorReturn(this, _Component.apply(this, arguments));
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.handleLocationChange = function (location) {
_this.store.dispatch({
type: LOCATION_CHANGE,
payload: location
});
}, _temp), _possibleConstructorReturn(_this, _ret);
}
ConnectedRouter.prototype.render = function render() {
ConnectedRouter.prototype.componentWillMount = function componentWillMount() {
var _props = this.props,
propsStore = _props.store,
history = _props.history,
children = _props.children,
props = _objectWithoutProperties(_props, ['store', 'history', 'children']);
history = _props.history;
var store = propsStore || this.context.store;
this.store = propsStore || this.context.store;
return React.createElement(
Router,
_extends({}, props, { history: history }),
React.createElement(Route, { render: function render(_ref) {
var location = _ref.location;
this.unsubscribeFromHistory = history.listen(this.handleLocationChange);
this.handleLocationChange(history.location);
};
store.dispatch({
type: LOCATION_CHANGE,
payload: location
});
ConnectedRouter.prototype.componentWillUnmount = function componentWillUnmount() {
if (this.unsubscribeFromHistory) this.unsubscribeFromHistory();
};
return children;
} })
);
ConnectedRouter.prototype.render = function render() {
return React.createElement(Router, this.props);
};

@@ -51,0 +52,0 @@

{
"name": "react-router-redux",
"version": "5.0.0-alpha.3",
"version": "5.0.0-alpha.4",
"description": "Redux bindings for React Router",

@@ -26,3 +26,3 @@ "repository": "ReactTraining/react-router",

"watch": "babel ./modules -d . --ignore __tests__ --watch",
"clean": "git clean -e '!node_modules' -fdX .",
"clean": "git clean -fdX .",
"lint": "eslint modules",

@@ -29,0 +29,0 @@ "test": "jest"

@@ -9,3 +9,3 @@ (function (global, factory) {

var _extends$1 = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };

@@ -36,3 +36,3 @@ /**

if (type === LOCATION_CHANGE) {
return _extends$1({}, state, { location: payload });
return _extends({}, state, { location: payload });
}

@@ -43,6 +43,2 @@

var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
function _objectWithoutProperties(obj, keys) { var target = {}; for (var i in obj) { if (keys.indexOf(i) >= 0) continue; if (!Object.prototype.hasOwnProperty.call(obj, i)) continue; target[i] = obj[i]; } return target; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }

@@ -58,30 +54,35 @@

function ConnectedRouter() {
var _temp, _this, _ret;
_classCallCheck(this, ConnectedRouter);
return _possibleConstructorReturn(this, _Component.apply(this, arguments));
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = _possibleConstructorReturn(this, _Component.call.apply(_Component, [this].concat(args))), _this), _this.handleLocationChange = function (location) {
_this.store.dispatch({
type: LOCATION_CHANGE,
payload: location
});
}, _temp), _possibleConstructorReturn(_this, _ret);
}
ConnectedRouter.prototype.render = function render() {
ConnectedRouter.prototype.componentWillMount = function componentWillMount() {
var _props = this.props,
propsStore = _props.store,
history = _props.history,
children = _props.children,
props = _objectWithoutProperties(_props, ['store', 'history', 'children']);
history = _props.history;
var store = propsStore || this.context.store;
this.store = propsStore || this.context.store;
return React__default.createElement(
reactRouter.Router,
_extends({}, props, { history: history }),
React__default.createElement(reactRouter.Route, { render: function render(_ref) {
var location = _ref.location;
this.unsubscribeFromHistory = history.listen(this.handleLocationChange);
this.handleLocationChange(history.location);
};
store.dispatch({
type: LOCATION_CHANGE,
payload: location
});
ConnectedRouter.prototype.componentWillUnmount = function componentWillUnmount() {
if (this.unsubscribeFromHistory) this.unsubscribeFromHistory();
};
return children;
} })
);
ConnectedRouter.prototype.render = function render() {
return React__default.createElement(reactRouter.Router, this.props);
};

@@ -88,0 +89,0 @@

@@ -1,1 +0,1 @@

!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-router")):"function"==typeof define&&define.amd?define(["exports","react","react-router"],t):t(e.ReactRouterRedux=e.ReactRouterRedux||{},e.React,e.ReactRouter)}(this,function(e,t,r){"use strict";function o(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:y,t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},r=t.type,o=t.payload;return r===l?f({},e,{location:o}):e}function n(e,t){var r={};for(var o in e)0>t.indexOf(o)&&Object.prototype.hasOwnProperty.call(e,o)&&(r[o]=e[o]);return r}function a(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function c(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function u(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function i(e){return function(){for(var t=arguments.length,r=Array(t),o=0;t>o;o++)r[o]=arguments[o];return{type:O,payload:{method:e,args:r}}}}function p(e){return function(){return function(t){return function(r){if(r.type!==O)return t(r);var o=r.payload;e[o.method].apply(e,o.args)}}}}var s="default"in t?t["default"]:t,f=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},l="@@router/LOCATION_CHANGE",y={location:null},d=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var r=arguments[t];for(var o in r)Object.prototype.hasOwnProperty.call(r,o)&&(e[o]=r[o])}return e},h=function(e){function t(){return a(this,t),c(this,e.apply(this,arguments))}return u(t,e),t.prototype.render=function(){var e=this.props,t=e.store,o=e.history,a=e.children,c=t||this.context.store;return s.createElement(r.Router,d({},n(e,["store","history","children"]),{history:o}),s.createElement(r.Route,{render:function(e){return c.dispatch({type:l,payload:e.location}),a}}))},t}(t.Component);h.propTypes={store:t.PropTypes.object,history:t.PropTypes.object,children:t.PropTypes.node},h.contextTypes={store:t.PropTypes.object};var O="@@router/CALL_HISTORY_METHOD",b=i("push"),g=i("replace"),v=i("go"),R=i("goBack"),j=i("goForward"),w={push:b,replace:g,go:v,goBack:R,goForward:j};e.ConnectedRouter=h,e.routerMiddleware=p,e.LOCATION_CHANGE=l,e.routerReducer=o,e.CALL_HISTORY_METHOD=O,e.push=b,e.replace=g,e.go=v,e.goBack=R,e.goForward=j,e.routerActions=w,Object.defineProperty(e,"__esModule",{value:!0})});
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react"),require("react-router")):"function"==typeof define&&define.amd?define(["exports","react","react-router"],t):t(e.ReactRouterRedux=e.ReactRouterRedux||{},e.React,e.ReactRouter)}(this,function(e,t,o){"use strict";function r(){var e=arguments.length>0&&arguments[0]!==undefined?arguments[0]:l,t=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{},o=t.type,r=t.payload;return o===f?s({},e,{location:r}):e}function n(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function i(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function a(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}function u(e){return function(){for(var t=arguments.length,o=Array(t),r=0;t>r;r++)o[r]=arguments[r];return{type:h,payload:{method:e,args:o}}}}function c(e){return function(){return function(t){return function(o){if(o.type!==h)return t(o);var r=o.payload;e[r.method].apply(e,r.args)}}}}var p="default"in t?t["default"]:t,s=Object.assign||function(e){for(var t=1;arguments.length>t;t++){var o=arguments[t];for(var r in o)Object.prototype.hasOwnProperty.call(o,r)&&(e[r]=o[r])}return e},f="@@router/LOCATION_CHANGE",l={location:null},y=function(e){function t(){var o,r,a;n(this,t);for(var u=arguments.length,c=Array(u),p=0;u>p;p++)c[p]=arguments[p];return o=r=i(this,e.call.apply(e,[this].concat(c))),r.handleLocationChange=function(e){r.store.dispatch({type:f,payload:e})},a=o,i(r,a)}return a(t,e),t.prototype.componentWillMount=function(){var e=this.props,t=e.store,o=e.history;this.store=t||this.context.store,this.unsubscribeFromHistory=o.listen(this.handleLocationChange),this.handleLocationChange(o.location)},t.prototype.componentWillUnmount=function(){this.unsubscribeFromHistory&&this.unsubscribeFromHistory()},t.prototype.render=function(){return p.createElement(o.Router,this.props)},t}(t.Component);y.propTypes={store:t.PropTypes.object,history:t.PropTypes.object,children:t.PropTypes.node},y.contextTypes={store:t.PropTypes.object};var h="@@router/CALL_HISTORY_METHOD",d=u("push"),b=u("replace"),g=u("go"),O=u("goBack"),R=u("goForward"),m={push:d,replace:b,go:g,goBack:O,goForward:R};e.ConnectedRouter=y,e.routerMiddleware=c,e.LOCATION_CHANGE=f,e.routerReducer=r,e.CALL_HISTORY_METHOD=h,e.push=d,e.replace=b,e.go=g,e.goBack=O,e.goForward=R,e.routerActions=m,Object.defineProperty(e,"__esModule",{value:!0})});
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc