Add 'Every' subscription for ticking with the system clock

This commit is contained in:
Christian Rocha
2020-05-05 13:36:46 -04:00
parent b50ee76165
commit ac67237eab
4 changed files with 28 additions and 21 deletions

View File

@@ -55,10 +55,7 @@ func update(message tea.Msg, mdl tea.Model) (tea.Model, tea.Cmd) {
func subscriptions(_ tea.Model) tea.Subs {
return tea.Subs{
"tick": func() tea.Msg {
time.Sleep(time.Second)
return tickMsg{}
},
"tick": tea.Every(time.Second, tickMsg{}),
}
}