21 lines
302 B
JavaScript
21 lines
302 B
JavaScript
function Session() {
|
|
var game = JSON.parse(localStorage.getItem('game'));
|
|
|
|
return {
|
|
hasSavedGame: hasSavedGame,
|
|
save : save
|
|
};
|
|
|
|
function hasSavedGame() {
|
|
return game != undefined;
|
|
}
|
|
|
|
function update(state) {
|
|
game = state;
|
|
}
|
|
|
|
function save() {
|
|
localStorage.setItem('game', game);
|
|
}
|
|
}
|