@@ -3,43 +3,47 @@ var invariant = require('react/lib/invariant');
3
3
var warning = require ( 'react/lib/warning' ) ;
4
4
var Path = require ( './utils/Path' ) ;
5
5
6
- function Route ( name , path , ignoreScrollBehavior , isDefault , isNotFound , onEnter , onLeave , handler ) {
7
- this . name = name ;
8
- this . path = path ;
9
- this . paramNames = Path . extractParamNames ( this . path ) ;
10
- this . ignoreScrollBehavior = ! ! ignoreScrollBehavior ;
11
- this . isDefault = ! ! isDefault ;
12
- this . isNotFound = ! ! isNotFound ;
13
- this . onEnter = onEnter ;
14
- this . onLeave = onLeave ;
15
- this . handler = handler ;
16
- }
6
+ class Route {
7
+
8
+ constructor ( name , path , ignoreScrollBehavior , isDefault , isNotFound , onEnter , onLeave , handler ) {
9
+ this . name = name ;
10
+ this . path = path ;
11
+ this . paramNames = Path . extractParamNames ( this . path ) ;
12
+ this . ignoreScrollBehavior = ! ! ignoreScrollBehavior ;
13
+ this . isDefault = ! ! isDefault ;
14
+ this . isNotFound = ! ! isNotFound ;
15
+ this . onEnter = onEnter ;
16
+ this . onLeave = onLeave ;
17
+ this . handler = handler ;
18
+ }
17
19
18
- /**
19
- * Appends the given route to this route's child routes.
20
- */
21
- Route . prototype . appendChild = function ( route ) {
22
- invariant (
23
- route instanceof Route ,
24
- 'route.appendChild must use a valid Route'
25
- ) ;
20
+ /**
21
+ * Appends the given route to this route's child routes.
22
+ */
23
+ appendChild ( route ) {
24
+ invariant (
25
+ route instanceof Route ,
26
+ 'route.appendChild must use a valid Route'
27
+ ) ;
26
28
27
- if ( ! this . childRoutes )
28
- this . childRoutes = [ ] ;
29
+ if ( ! this . childRoutes )
30
+ this . childRoutes = [ ] ;
29
31
30
- this . childRoutes . push ( route ) ;
31
- } ;
32
+ this . childRoutes . push ( route ) ;
33
+ }
32
34
33
- Route . prototype . toString = function ( ) {
34
- var string = '<Route' ;
35
+ toString ( ) {
36
+ var string = '<Route' ;
35
37
36
- if ( this . name )
37
- string += ` name="${ this . name } "` ;
38
+ if ( this . name )
39
+ string += ` name="${ this . name } "` ;
38
40
39
- string += ` path="${ this . path } ">` ;
41
+ string += ` path="${ this . path } ">` ;
40
42
41
- return string ;
42
- } ;
43
+ return string ;
44
+ }
45
+
46
+ }
43
47
44
48
var _currentRoute ;
45
49
0 commit comments