From e83c113d06a4b8448196273703b3e897856db0dd Mon Sep 17 00:00:00 2001 From: Christian Rocha Date: Mon, 10 Jan 2022 14:13:28 -0500 Subject: [PATCH] Add spinner.Model.Tick method, deprecate spinner.Tick method. --- spinner/spinner.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/spinner/spinner.go b/spinner/spinner.go index d321c62b..d3b21ee0 100644 --- a/spinner/spinner.go +++ b/spinner/spinner.go @@ -254,8 +254,12 @@ func (m Model) View() string { // Tick is the command used to advance the spinner one frame. Use this command // to effectively start the spinner. -func Tick() tea.Msg { - return TickMsg{Time: time.Now()} +func (m Model) Tick() tea.Msg { + return TickMsg{ + Time: time.Now(), + id: m.id, + tag: m.tag, + } } func (m Model) tick(id, tag int) tea.Cmd { @@ -267,3 +271,11 @@ func (m Model) tick(id, tag int) tea.Cmd { } }) } + +// Tick is the command used to advance the spinner one frame. Use this command +// to effectively start the spinner. +// +// This method is deprecated. Use Model.Tick instead. +func Tick() tea.Msg { + return TickMsg{Time: time.Now()} +}