wait simplify

This commit is contained in:
Maas Lalani 2021-08-06 22:25:00 -04:00
parent ebb2591f66
commit 46edff14e5
No known key found for this signature in database
GPG Key ID: F53774FA051C052A

View File

@ -30,9 +30,9 @@ func animate() tea.Cmd {
}) })
} }
func waitASec(ms int) tea.Cmd { func wait(d time.Duration) tea.Cmd {
return func() tea.Msg { return func() tea.Msg {
time.Sleep(time.Millisecond * time.Duration(ms)) time.Sleep(d)
return nil return nil
} }
} }
@ -79,7 +79,7 @@ func InitialModel() model {
} }
func (m model) Init() tea.Cmd { func (m model) Init() tea.Cmd {
return tea.Sequentially(waitASec(500), animate()) return tea.Sequentially(wait(time.Second), animate())
} }
func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {