@@ -11,24 +11,38 @@ var _location;
11
11
var _currentPath = '/' ;
12
12
var _lastPath = null ;
13
13
14
+ function getWindowPath ( ) {
15
+ return window . location . pathname + window . location . search ;
16
+ }
17
+
14
18
var EventEmitter = require ( 'event-emitter' ) ;
15
19
var _events = EventEmitter ( ) ;
16
20
17
21
function notifyChange ( ) {
18
22
_events . emit ( 'change' ) ;
19
23
}
20
24
21
- function getWindowPath ( ) {
22
- return window . location . pathname + window . location . search ;
23
- }
24
-
25
25
/**
26
26
* The URLStore keeps track of the current URL. In DOM environments, it may be
27
27
* attached to window.location to automatically sync with the URL in a browser's
28
28
* location bar. <Route>s subscribe to the URLStore to know when the URL changes.
29
29
*/
30
30
var URLStore = {
31
31
32
+ /**
33
+ * Adds a listener that will be called when this store changes.
34
+ */
35
+ addChangeListener : function ( listener ) {
36
+ _events . on ( 'change' , listener ) ;
37
+ } ,
38
+
39
+ /**
40
+ * Removes the given change listener.
41
+ */
42
+ removeChangeListener : function ( listener ) {
43
+ _events . off ( 'change' , listener ) ;
44
+ } ,
45
+
32
46
/**
33
47
* Returns the type of navigation that is currently being used.
34
48
*/
@@ -164,20 +178,6 @@ var URLStore = {
164
178
}
165
179
166
180
_location = null ;
167
- } ,
168
-
169
- /**
170
- * Adds a listener that will be called when this store changes.
171
- */
172
- addChangeListener : function ( listener ) {
173
- _events . on ( 'change' , listener ) ;
174
- } ,
175
-
176
- /**
177
- * Removes the given change listener.
178
- */
179
- removeChangeListener : function ( listener ) {
180
- _events . off ( 'change' , listener ) ;
181
181
}
182
182
183
183
} ;
0 commit comments