File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -50,24 +50,24 @@ function getStoreUrl() {
50
50
} ) ;
51
51
}
52
52
53
+ const MARKETVERSION_STARTTOKEN = "softwareVersion\">" ;
54
+ const MARKETVERSION_STARTTOKEN_LENGTH = MARKETVERSION_STARTTOKEN . length ;
55
+ const MARKETVERSION_ENDTOKEN = "<" ;
53
56
function getLatestVersionFromUrl ( url , fetchOptions ) {
54
57
return fetch ( url , fetchOptions )
55
58
. then ( res => {
56
59
return res . text ( ) ;
57
60
} )
58
61
. then ( ( text ) => {
59
- const startToken = "softwareVersion\">" ;
60
- const endToken = "<" ;
61
-
62
- const indexStart = text . indexOf ( startToken ) ;
62
+ const indexStart = text . indexOf ( MARKETVERSION_STARTTOKEN ) ;
63
63
if ( indexStart === - 1 ) {
64
64
latestVersion = text . trim ( ) ;
65
65
return Promise . resolve ( latestVersion ) ;
66
66
}
67
67
68
- text = text . substr ( indexStart + startToken . length ) ;
68
+ text = text . substr ( indexStart + MARKETVERSION_STARTTOKEN_LENGTH ) ;
69
69
70
- const indexEnd = text . indexOf ( endToken ) ;
70
+ const indexEnd = text . indexOf ( MARKETVERSION_ENDTOKEN ) ;
71
71
if ( indexEnd === - 1 ) {
72
72
return Promise . reject ( "Parse error." ) ;
73
73
}
You can’t perform that action at this time.
0 commit comments