summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorDavid Gay <david@davidgay.org>2021-06-03 22:03:16 -0400
committerDavid Gay <david@davidgay.org>2021-06-03 22:03:16 -0400
commita02cf6d28a28d312b8a4a8e8feb40eb03289a090 (patch)
treed1ae91742d5df9b40810ff78981334ca68016b07 /app
parent25c9a1650e7dd9b302b1d47e4a33721d759c44b7 (diff)
Timer: Improve accuracy/feel by starting to count down immediately (before this, there was an uncomfortable delay)
Diffstat (limited to 'app')
-rw-r--r--app/javascript/controllers/timer_controller.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/app/javascript/controllers/timer_controller.js b/app/javascript/controllers/timer_controller.js
index 5190a79..901ec0a 100644
--- a/app/javascript/controllers/timer_controller.js
+++ b/app/javascript/controllers/timer_controller.js
@@ -32,10 +32,11 @@ export default class extends Controller {
return;
}
+ if (controller.counter > 0) controller.counter--;
+
if (controller.counter > 0) {
controller.timerTarget.textContent = controller.counter.toString();
- controller.counter--;
- } else if (this.counter <= 0) {
+ } else {
Rails.ajax({
type: "POST",
url: controller.postUrlValue,