Add spinner.Model.Tick method, deprecate spinner.Tick method.

This commit is contained in:
Christian Rocha 2022-01-10 14:13:28 -05:00
parent 94b84b6120
commit e83c113d06

View File

@ -254,8 +254,12 @@ func (m Model) View() string {
// Tick is the command used to advance the spinner one frame. Use this command // Tick is the command used to advance the spinner one frame. Use this command
// to effectively start the spinner. // to effectively start the spinner.
func Tick() tea.Msg { func (m Model) Tick() tea.Msg {
return TickMsg{Time: time.Now()} return TickMsg{
Time: time.Now(),
id: m.id,
tag: m.tag,
}
} }
func (m Model) tick(id, tag int) tea.Cmd { 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()}
}