File tree 1 file changed +5
-5
lines changed
1 file changed +5
-5
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ var route = {
5
5
6
6
routes : [ ] ,
7
7
funcs : [ ] ,
8
- actualURL : '' ,
8
+ currentHash : '' ,
9
9
interval : null ,
10
10
11
11
add : function ( route , func ) {
@@ -20,14 +20,14 @@ var route = {
20
20
} ,
21
21
22
22
_check : function ( ) {
23
- if ( this . actualURL != document . location . href ) {
24
- this . actualURL = document . location . href ;
23
+ if ( document . location . hash && this . currentHash != document . location . hash ) {
24
+ this . currentHash = document . location . hash . slice ( 1 ) ;
25
25
this . _update ( ) ;
26
26
}
27
27
} ,
28
28
29
29
_findAndExecute : function ( route ) {
30
- for ( var i = 0 ; i < this . routes . length ; i ++ ) {
30
+ for ( var i = 0 , l = this . routes . length ; i < l ; i ++ ) {
31
31
var re = new RegExp ( this . routes [ i ] ) ;
32
32
var match = route . match ( re ) ;
33
33
@@ -40,7 +40,7 @@ var route = {
40
40
} ,
41
41
42
42
_update : function ( ) {
43
- var hash = location . hash . slice ( 1 ) ;
43
+ var hash = this . currentHash ;
44
44
45
45
this . _findAndExecute ( hash ) ;
46
46
} ,
You can’t perform that action at this time.
0 commit comments