mirror of
https://github.com/Maks1mS/bubbles.git
synced 2024-12-23 22:32:59 +03:00
Update spinner to use proper tea.Tick subscription
This commit is contained in:
parent
5179df1982
commit
a72bf9128d
@ -50,7 +50,7 @@ func NewModel() Model {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TickMsg indicates that the timer has ticked and we should render a frame
|
// TickMsg indicates that the timer has ticked and we should render a frame
|
||||||
type TickMsg struct{}
|
type TickMsg time.Time
|
||||||
|
|
||||||
// Update is the Tea update function
|
// Update is the Tea update function
|
||||||
func Update(msg tea.Msg, m Model) (Model, tea.Cmd) {
|
func Update(msg tea.Msg, m Model) (Model, tea.Cmd) {
|
||||||
@ -94,8 +94,7 @@ func MakeSub(model tea.Model) (tea.Sub, error) {
|
|||||||
if !ok {
|
if !ok {
|
||||||
return nil, assertionErr
|
return nil, assertionErr
|
||||||
}
|
}
|
||||||
return func() tea.Msg {
|
return tea.Tick(time.Second/time.Duration(m.FPS), func(t time.Time) tea.Msg {
|
||||||
time.Sleep(time.Second / time.Duration(m.FPS))
|
return TickMsg(t)
|
||||||
return TickMsg{}
|
}), nil
|
||||||
}, nil
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user