forked from felixrieseberg/Node-Mayhem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhighscore.js
21 lines (19 loc) · 803 Bytes
/
highscore.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Highscore manager, responsible for displaying and updating
// players' scores
/* ----------------------------------------------------------------- */
(function () {
var highscoreManager = {
init: function () {
highscoreManager.score = document.getElementById('individualScores');
},
addPlayer: function (username, points) {
var newElement = document.createElement('li');
newElement.textContent(username + ': ' + points);
newElement.setAttribute('id', 'individualScore-' + username);
},
updatePlayer: function (username, points) {
var updateElement = document.getElementById('individualScore-' + username);
updateElement.textContent(username + ': ' + points);
}
};
})();