@@ -18,15 +18,15 @@ window.fakeStorage = {
18
18
}
19
19
} ;
20
20
21
- function LocalScoreManager ( ) {
21
+ function LocalStorageManager ( ) {
22
22
this . bestScoreKey = "bestScore" ;
23
23
this . gameStateKey = "gameState" ;
24
24
25
25
var supported = this . localStorageSupported ( ) ;
26
26
this . storage = supported ? window . localStorage : window . fakeStorage ;
27
27
}
28
28
29
- LocalScoreManager . prototype . localStorageSupported = function ( ) {
29
+ LocalStorageManager . prototype . localStorageSupported = function ( ) {
30
30
var testKey = "test" ;
31
31
var storage = window . localStorage ;
32
32
@@ -39,23 +39,23 @@ LocalScoreManager.prototype.localStorageSupported = function () {
39
39
}
40
40
} ;
41
41
42
- LocalScoreManager . prototype . getBestScore = function ( ) {
42
+ LocalStorageManager . prototype . getBestScore = function ( ) {
43
43
return this . storage . getItem ( this . bestScoreKey ) || 0 ;
44
44
} ;
45
45
46
- LocalScoreManager . prototype . setBestScore = function ( score ) {
46
+ LocalStorageManager . prototype . setBestScore = function ( score ) {
47
47
this . storage . setItem ( this . bestScoreKey , score ) ;
48
48
} ;
49
49
50
- LocalScoreManager . prototype . getGameState = function ( ) {
51
- var stateJSON = this . storage . getItem ( this . gameStateKey ) ;
52
- return stateJSON ? JSON . parse ( stateJSON ) : null ;
50
+ LocalStorageManager . prototype . getGameState = function ( ) {
51
+ var stateJSON = this . storage . getItem ( this . gameStateKey ) ;
52
+ return stateJSON ? JSON . parse ( stateJSON ) : null ;
53
53
} ;
54
54
55
- LocalScoreManager . prototype . setGameState = function ( gameState ) {
56
- this . storage . setItem ( this . gameStateKey , JSON . stringify ( gameState ) ) ;
55
+ LocalStorageManager . prototype . setGameState = function ( gameState ) {
56
+ this . storage . setItem ( this . gameStateKey , JSON . stringify ( gameState ) ) ;
57
57
} ;
58
58
59
- LocalScoreManager . prototype . clearGameState = function ( ) {
60
- this . storage . removeItem ( this . gameStateKey ) ;
59
+ LocalStorageManager . prototype . clearGameState = function ( ) {
60
+ this . storage . removeItem ( this . gameStateKey ) ;
61
61
} ;
0 commit comments