Fix: bug in timer
This commit is contained in:
parent
f42e8478e1
commit
bf922ead94
2 changed files with 1 additions and 8 deletions
|
@ -25,16 +25,9 @@
|
|||
</hgroup>
|
||||
|
||||
<div x-data="Timer">
|
||||
<div x-show="!time">
|
||||
<div class="timer loading" href="#" aria-busy="true">
|
||||
please wait
|
||||
</div>
|
||||
</div>
|
||||
<div x-show="time">
|
||||
<p :class="'timer' + ($store.remoteState.isMyTurn ? ' my-turn':'') + (time < 0 ? ' over':'')"
|
||||
x-text="time + 's'"></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button @click="$store.remoteState.giveTurnToNextPlayer()"
|
||||
x-bind:disabled="$store.remoteState.currentPlayer !== $store.localState.id">
|
||||
|
|
|
@ -47,7 +47,7 @@ function Timer() {
|
|||
if (!lastPlayerSwitch) {
|
||||
this.time = null;
|
||||
} else {
|
||||
this.time = parseInt(
|
||||
this.time = Math.floor(
|
||||
((Alpine.store("remoteState").interval * 1000) - (new Date().getTime() - lastPlayerSwitch)) / 1000
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue