Split generic scorecard with 2 and 4 player variants
All checks were successful
/ publish (push) Successful in 1m33s
All checks were successful
/ publish (push) Successful in 1m33s
This commit is contained in:
parent
cbd55175ae
commit
6f258bf13d
9 changed files with 373 additions and 5 deletions
|
|
@ -12,7 +12,13 @@
|
|||
<script src="./scripts/main.js" type="module"></script>
|
||||
</head>
|
||||
<body class="container">
|
||||
<h1>Scorecard</h1>
|
||||
<header>
|
||||
<hgroup>
|
||||
<h1>Scorecard</h1>
|
||||
<p>4 Players</p>
|
||||
</hgroup>
|
||||
</header>
|
||||
|
||||
|
||||
<div data-controller="finska-scorecard">
|
||||
<table class="score-table">
|
||||
|
|
|
|||
|
|
@ -119,13 +119,13 @@ class StoreDAO {
|
|||
}
|
||||
|
||||
save(scoreCard) {
|
||||
this._localStorage.setItem('generic-scorecard', JSON.stringify(scoreCard.toJson()));
|
||||
this._localStorage.setItem('generic-scorecard-4p', JSON.stringify(scoreCard.toJson()));
|
||||
}
|
||||
|
||||
loadOrCreate() {
|
||||
try {
|
||||
console.log("Loading scorecard");
|
||||
let scoreCardJson = this._localStorage.getItem('generic-scorecard');
|
||||
let scoreCardJson = this._localStorage.getItem('generic-scorecard-4p');
|
||||
if (scoreCardJson !== null) {
|
||||
return Scorecard.fromJson(JSON.parse(scoreCardJson));
|
||||
}
|
||||
|
|
@ -137,7 +137,7 @@ class StoreDAO {
|
|||
}
|
||||
|
||||
clear() {
|
||||
this._localStorage.removeItem('generic-scorecard');
|
||||
this._localStorage.removeItem('generic-scorecard-4p');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue