commit 877daaf8f677b7740653b59209772be323f3a2aa
parent a894eeefbd743bd40e41e2fd37ab53593457eeeb
Author: Evgeny Murashkin <rusjoan@ya.ru>
Date: Fri, 15 Apr 2016 13:28:52 +0300
Renamed 'core/Location' to 'core/history'
npm history module v2.0.2
Diffstat:
5 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/package.json b/package.json
@@ -21,7 +21,7 @@
"front-matter": "2.0.7",
"graphiql": "0.7.0",
"graphql": "0.5.0",
- "history": "2.0.1",
+ "history": "2.0.2",
"isomorphic-style-loader": "0.0.12",
"jade": "1.11.0",
"jsonwebtoken": "5.7.0",
diff --git a/src/client.js b/src/client.js
@@ -12,7 +12,7 @@ import ReactDOM from 'react-dom';
import FastClick from 'fastclick';
import { match } from 'universal-router';
import routes from './routes';
-import Location from './core/Location';
+import history from './core/history';
import { addEventListener, removeEventListener } from './core/DOMUtils';
const context = {
@@ -82,7 +82,7 @@ function run() {
FastClick.attach(document.body);
// Re-render the app when window.location changes
- const removeLocationListener = Location.listen(location => {
+ const removeLocationListener = history.listen(location => {
currentLocation = location;
match(routes, {
path: location.pathname,
diff --git a/src/components/Link/Link.js b/src/components/Link/Link.js
@@ -8,7 +8,7 @@
*/
import React, { Component, PropTypes } from 'react';
-import Location from '../../core/Location';
+import history from '../../core/history';
function isLeftClickEvent(event) {
return event.button === 0;
@@ -44,9 +44,9 @@ class Link extends Component { // eslint-disable-line react/prefer-stateless-fun
if (allowTransition) {
if (this.props.to) {
- Location.push(this.props.to);
+ history.push(this.props.to);
} else {
- Location.push({
+ history.push({
pathname: event.currentTarget.pathname,
search: event.currentTarget.search,
});
@@ -56,7 +56,7 @@ class Link extends Component { // eslint-disable-line react/prefer-stateless-fun
render() {
const { to, ...props } = this.props; // eslint-disable-line no-use-before-define
- return <a href={Location.createHref(to)} {...props} onClick={this.handleClick} />;
+ return <a href={history.createHref(to)} {...props} onClick={this.handleClick} />;
}
}
diff --git a/src/core/Location.js b/src/core/Location.js
@@ -1,16 +0,0 @@
-/**
- * React Starter Kit (https://www.reactstarterkit.com/)
- *
- * Copyright © 2014-2016 Kriasoft, LLC. All rights reserved.
- *
- * This source code is licensed under the MIT license found in the
- * LICENSE.txt file in the root directory of this source tree.
- */
-
-import createHistory from 'history/lib/createBrowserHistory';
-import createMemoryHistory from 'history/lib/createMemoryHistory';
-import useQueries from 'history/lib/useQueries';
-
-const location = useQueries(process.env.BROWSER ? createHistory : createMemoryHistory)();
-
-export default location;
diff --git a/src/core/history.js b/src/core/history.js
@@ -0,0 +1,16 @@
+/**
+ * React Starter Kit (https://www.reactstarterkit.com/)
+ *
+ * Copyright © 2014-2016 Kriasoft, LLC. All rights reserved.
+ *
+ * This source code is licensed under the MIT license found in the
+ * LICENSE.txt file in the root directory of this source tree.
+ */
+
+import createHistory from 'history/lib/createBrowserHistory';
+import createMemoryHistory from 'history/lib/createMemoryHistory';
+import useQueries from 'history/lib/useQueries';
+
+const history = useQueries(process.env.BROWSER ? createHistory : createMemoryHistory)();
+
+export default history;