Skip to content

Commit 2ae49e7

Browse files
committed
Group framework methods
1 parent 7672f7b commit 2ae49e7

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

modules/createRouter.js

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -482,21 +482,18 @@ function createRouter(options) {
482482
children: PropTypes.falsy
483483
},
484484

485-
getLocation: function () {
486-
return location;
487-
},
488-
489-
getScrollBehavior: function () {
490-
return scrollBehavior;
491-
},
492-
493-
getRouteAtDepth: function (depth) {
494-
var routes = this.state.routes;
495-
return routes && routes[depth];
485+
childContextTypes: {
486+
getRouteAtDepth: React.PropTypes.func.isRequired,
487+
setRouteComponentAtDepth: React.PropTypes.func.isRequired,
488+
routeHandlers: React.PropTypes.array.isRequired
496489
},
497490

498-
setRouteComponentAtDepth: function (depth, component) {
499-
mountedComponents[depth] = component;
491+
getChildContext: function () {
492+
return {
493+
getRouteAtDepth: this.getRouteAtDepth,
494+
setRouteComponentAtDepth: this.setRouteComponentAtDepth,
495+
routeHandlers: [ this ]
496+
};
500497
},
501498

502499
getInitialState: function () {
@@ -511,23 +508,26 @@ function createRouter(options) {
511508
Router.stop();
512509
},
513510

514-
render: function () {
515-
var route = this.getRouteAtDepth(0);
516-
return route ? React.createElement(route.handler, this.props) : null;
511+
getLocation: function () {
512+
return location;
517513
},
518514

519-
childContextTypes: {
520-
getRouteAtDepth: React.PropTypes.func.isRequired,
521-
setRouteComponentAtDepth: React.PropTypes.func.isRequired,
522-
routeHandlers: React.PropTypes.array.isRequired
515+
getScrollBehavior: function () {
516+
return scrollBehavior;
523517
},
524518

525-
getChildContext: function () {
526-
return {
527-
getRouteAtDepth: this.getRouteAtDepth,
528-
setRouteComponentAtDepth: this.setRouteComponentAtDepth,
529-
routeHandlers: [ this ]
530-
};
519+
getRouteAtDepth: function (depth) {
520+
var routes = this.state.routes;
521+
return routes && routes[depth];
522+
},
523+
524+
setRouteComponentAtDepth: function (depth, component) {
525+
mountedComponents[depth] = component;
526+
},
527+
528+
render: function () {
529+
var route = this.getRouteAtDepth(0);
530+
return route ? React.createElement(route.handler, this.props) : null;
531531
}
532532

533533
});

0 commit comments

Comments
 (0)