Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/topheman/highscoresmanager.js
Simlple high scores manager with localStorage
https://github.com/topheman/highscoresmanager.js
Last synced: about 2 months ago
JSON representation
Simlple high scores manager with localStorage
- Host: GitHub
- URL: https://github.com/topheman/highscoresmanager.js
- Owner: topheman
- Created: 2013-08-16T21:34:49.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2013-08-16T21:36:06.000Z (over 11 years ago)
- Last Synced: 2024-04-08T00:39:39.411Z (9 months ago)
- Language: JavaScript
- Homepage:
- Size: 102 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
HighScoresManager.js
====================Manages high scores, uses localStorage if enabled, fallback to memory if not.
Creating the instance, you can specify how many highscores you want to manage in your top + in options, the key in the localStorage
```js
var _highScoresManager = new HighScoresManager(10,{localStorageKeyName:'mySpecialKey'});
var performance = {
"score" : 12000
"level" : 2
}
_highScoresManager.addHighScore(performance.score,performance.level);//adds/sorts the scores - removes the trailing ones and saves them to localStorage
console.log(_highScoresManager.getHighScores());
```Used in :
* https://github.com/topheman/squares
* https://github.com/topheman/bombs