From 6e936e647b54c761fc88c5d8fbe3fed9fe70e15b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakob=20L=C3=B6hnertz?= Date: Tue, 11 Jun 2024 00:03:59 +0200 Subject: [PATCH] Fix that when an infusion finished, the remaining time in the window title is updated to the new infusion --- src/components/TimerDisplay.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/TimerDisplay.vue b/src/components/TimerDisplay.vue index bbbb4cc..bb61f98 100644 --- a/src/components/TimerDisplay.vue +++ b/src/components/TimerDisplay.vue @@ -69,6 +69,7 @@ export default defineComponent({ incrementTime: 'updateTimeRemaining', offsetTime: 'updateTimeRemaining', infusionCount: 'updateTimeRemaining', + timeRemaining: 'updateWindowTitle', }, methods: { /** @@ -102,18 +103,23 @@ export default defineComponent({ startTimer() { this.timerRunning = true this.$emit('updateTimerRunning', this.timerRunning) + this.timeRemaining = this.infusionTime + this.intervalId = setInterval(() => { this.timeRemaining -= 0.1 + this.timerProgressPercent = this.calculateTimeElapsed( this.infusionTime - this.timeRemaining, this.infusionTime, ) + if (this.timeRemaining <= 5 && !this.beepWarningPlayed) { this.beepWarningPlayed = true this.timerProgressBarColor = 'is-warning' this.beepWarning.play() } + if (this.timeRemaining <= 0) { clearInterval(this.intervalId as number) this.timerRunning = false @@ -121,7 +127,6 @@ export default defineComponent({ this.beepEnd.play() this.$emit('finishInfusion') } - this.updateWindowTitle() }, 100) }, /**