Fix win/over in local
[2048.git] / js / local_score_manager.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
function LocalScoreManager() {
  this.key = 'bestScore';
}
 
LocalScoreManager.prototype.get = function () {
  if (!this.isSupported()) {
    return 0;
  }
 
  return localStorage.getItem(this.key);
};
 
LocalScoreManager.prototype.set = function (score) {
  if (!this.isSupported()) {
    return false;
  }
 
  localStorage.setItem(this.key, score);
};
 
LocalScoreManager.prototype.isSupported = function () {
  return !!window.localStorage;
};
 
 
comments