feat: implement asynchronous timer start
- add new StartAsync method to Timer for non-blocking execution
- use new method in RunPomodoro()
🤖
This commit is contained in:
parent
d0b1260f62
commit
94b6786c7c
2 changed files with 9 additions and 4 deletions
|
@ -42,7 +42,7 @@ func RunPomodoro() {
|
|||
|
||||
// Work
|
||||
shared.State.Mode = "Work"
|
||||
go timer.Start(pomodoroConfig.Work)
|
||||
timer.StartAsync(pomodoroConfig.Work)
|
||||
if !waitForTimer(timer) {
|
||||
break
|
||||
}
|
||||
|
@ -50,13 +50,13 @@ func RunPomodoro() {
|
|||
// Breaks
|
||||
if session < pomodoroConfig.Sessions {
|
||||
shared.State.Mode = "ShortBreak"
|
||||
go timer.Start(pomodoroConfig.ShortBreak)
|
||||
timer.StartAsync(pomodoroConfig.ShortBreak)
|
||||
if !waitForTimer(timer) {
|
||||
break
|
||||
}
|
||||
} else { // last phase, prepare for finish
|
||||
shared.State.Mode = "LongBreak"
|
||||
go timer.Start(pomodoroConfig.LongBreak)
|
||||
timer.StartAsync(pomodoroConfig.LongBreak)
|
||||
if !waitForTimer(timer) {
|
||||
break
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue