Skip to content

Commit

Permalink
Add spinner.Model.Tick method, deprecate spinner.Tick method.
Browse files Browse the repository at this point in the history
  • Loading branch information
meowgorithm committed Jan 10, 2022
1 parent 94b84b6 commit e83c113
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions spinner/spinner.go
Expand Up @@ -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 {
Expand All @@ -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()}
}

0 comments on commit e83c113

Please sign in to comment.