From 843b6a52498227d68ef198e36dc526a2c60a028e Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Mon, 10 Jan 2022 14:20:15 -0500 Subject: [PATCH] Use model-based Tick commands in spinner examples --- examples/spinner/main.go | 2 +- examples/spinners/main.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/spinner/main.go b/examples/spinner/main.go index 47bf5a2..a65373e 100644 --- a/examples/spinner/main.go +++ b/examples/spinner/main.go @@ -28,7 +28,7 @@ func initialModel() model { } func (m model) Init() tea.Cmd { - return spinner.Tick + return m.spinner.Tick } func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { diff --git a/examples/spinners/main.go b/examples/spinners/main.go index fed6c5b..67d722f 100644 --- a/examples/spinners/main.go +++ b/examples/spinners/main.go @@ -44,7 +44,7 @@ type model struct { } func (m model) Init() tea.Cmd { - return spinner.Tick + return m.spinner.Tick } func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { @@ -59,14 +59,14 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) { m.index = len(spinners) - 1 } m.resetSpinner() - return m, spinner.Tick + return m, m.spinner.Tick case "l", "right": m.index++ if m.index >= len(spinners) { m.index = 0 } m.resetSpinner() - return m, spinner.Tick + return m, m.spinner.Tick default: return m, nil }