feat: refactor to use local pointer for ServerMessage
- replace `shared.ServerMessage` with local pomodoro pointer
- update conditions to use `pomodoro` instead of `shared.ServerMessage`
🤖
This commit is contained in:
parent
a61da7d280
commit
98013780da
3 changed files with 24 additions and 23 deletions
|
@ -29,15 +29,16 @@ func Start() {
|
|||
}
|
||||
|
||||
go websocket.ProcessServerMessages(conn)
|
||||
pomodoro := &shared.ServerMessage
|
||||
|
||||
keyboard.Listen(func(key keys.Key) (stop bool, err error) {
|
||||
switch key.String() {
|
||||
case "space":
|
||||
if !shared.ServerMessage.Ongoing {
|
||||
if !pomodoro.Ongoing {
|
||||
websocket.SendCmd(conn, *password, "start")
|
||||
return false, nil
|
||||
}
|
||||
if shared.ServerMessage.Paused {
|
||||
if pomodoro.Paused {
|
||||
websocket.SendCmd(conn, *password, "resume")
|
||||
return false, nil
|
||||
} else {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue