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