Skip to content

Commit ae6fcda

Browse files
committed
[changed] Rename Scrolling => ScrollHistory
1 parent 8276235 commit ae6fcda

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

modules/Scrolling.js renamed to modules/ScrollHistory.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ function shouldUpdateScroll(state, prevState) {
2626
* Provides the router with the ability to manage window scroll position
2727
* according to its scroll behavior.
2828
*/
29-
var Scrolling = {
29+
var ScrollHistory = {
3030

3131
statics: {
32+
3233
/**
3334
* Records curent scroll position as the last known position for the given URL path.
3435
*/
@@ -48,11 +49,12 @@ var Scrolling = {
4849

4950
return this.scrollHistory[path] || null;
5051
}
52+
5153
},
5254

5355
componentWillMount: function () {
5456
invariant(
55-
this.getScrollBehavior() == null || canUseDOM,
57+
this.constructor.getScrollBehavior() == null || canUseDOM,
5658
'Cannot use scroll behavior without a DOM'
5759
);
5860
},
@@ -69,7 +71,7 @@ var Scrolling = {
6971
if (!shouldUpdateScroll(this.state, prevState))
7072
return;
7173

72-
var scrollBehavior = this.getScrollBehavior();
74+
var scrollBehavior = this.constructor.getScrollBehavior();
7375

7476
if (scrollBehavior)
7577
scrollBehavior.updateScrollPosition(
@@ -80,4 +82,4 @@ var Scrolling = {
8082

8183
};
8284

83-
module.exports = Scrolling;
85+
module.exports = ScrollHistory;

modules/createRouter.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ var HistoryLocation = require('./locations/HistoryLocation');
1010
var RefreshLocation = require('./locations/RefreshLocation');
1111
var StaticLocation = require('./locations/StaticLocation');
1212
var NavigationContext = require('./NavigationContext');
13+
var ScrollHistory = require('./ScrollHistory');
1314
var StateContext = require('./StateContext');
14-
var Scrolling = require('./Scrolling');
1515
var createRoutesFromReactChildren = require('./Routing').createRoutesFromReactChildren;
1616
var isReactChildren = require('./isReactChildren');
1717
var Transition = require('./Transition');
@@ -442,11 +442,15 @@ function createRouter(options) {
442442
location.removeChangeListener(Router.handleLocationChange);
443443

444444
this.isRunning = false;
445+
},
446+
447+
getScrollBehavior: function () {
448+
return scrollBehavior;
445449
}
446450

447451
},
448452

449-
mixins: [ NavigationContext, StateContext, Scrolling ],
453+
mixins: [ NavigationContext, StateContext, ScrollHistory ],
450454

451455
propTypes: {
452456
children: PropTypes.falsy
@@ -482,10 +486,6 @@ function createRouter(options) {
482486
return location;
483487
},
484488

485-
getScrollBehavior: function () {
486-
return scrollBehavior;
487-
},
488-
489489
getRouteAtDepth: function (depth) {
490490
var routes = this.state.routes;
491491
return routes && routes[depth];

0 commit comments

Comments
 (0)