Skip to content

Commit

Permalink
Fix that when an infusion finished, the remaining time in the window …
Browse files Browse the repository at this point in the history
…title is updated to the new infusion
  • Loading branch information
loehnertz committed Jun 10, 2024
1 parent b535d7e commit 6e936e6
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/TimerDisplay.vue
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export default defineComponent({
incrementTime: 'updateTimeRemaining',
offsetTime: 'updateTimeRemaining',
infusionCount: 'updateTimeRemaining',
timeRemaining: 'updateWindowTitle',
},
methods: {
/**
Expand Down Expand Up @@ -102,26 +103,30 @@ 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
this.$emit('updateTimerRunning', this.timerRunning)
this.beepEnd.play()
this.$emit('finishInfusion')
}
this.updateWindowTitle()
}, 100)
},
/**
Expand Down

0 comments on commit 6e936e6

Please sign in to comment.