From 93adce2131013d3dd58ccfc04c1efdd8ead46d70 Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Sun, 25 Oct 2020 17:08:58 -0400 Subject: [PATCH] Minor simplification to countdown example --- examples/countdown/main.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/countdown/main.go b/examples/countdown/main.go index ba7533d..0eeefd7 100644 --- a/examples/countdown/main.go +++ b/examples/countdown/main.go @@ -32,7 +32,7 @@ type model struct { } func (m model) Init() tea.Cmd { - return m.tick() + return tick() } func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { @@ -44,7 +44,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { return m, tea.Quit } m.lastTick = t - return m, m.tick() + return m, tick() case tea.KeyMsg: switch msg.String() { @@ -63,7 +63,7 @@ func (m model) View() string { return fmt.Sprintf("This program will quit in %02d:%02d\n", secs, millis) } -func (m model) tick() tea.Cmd { +func tick() tea.Cmd { return tea.Tick(time.Duration(interval), func(t time.Time) tea.Msg { return tickMsg(t) })