forked from Mirrors/bubbletea
Update spinner example so it works with the spinner version in master
This commit is contained in:
parent
2a82e2a75e
commit
88e4df4055
|
@ -1,7 +1,6 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
|
@ -83,14 +82,17 @@ func view(model tea.Model) string {
|
|||
return fmt.Sprintf("\n\n %s Loading forever...press q to quit\n\n", s)
|
||||
}
|
||||
|
||||
func subscriptions(_ tea.Model) tea.Subs {
|
||||
return tea.Subs{
|
||||
"tick": func(model tea.Model) tea.Msg {
|
||||
func subscriptions(model tea.Model) tea.Subs {
|
||||
m, ok := model.(Model)
|
||||
if !ok {
|
||||
return errMsg(errors.New("could perform assertion on model in subscription"))
|
||||
return nil
|
||||
}
|
||||
return spinner.Sub(m.spinner)
|
||||
},
|
||||
|
||||
sub, err := spinner.MakeSub(m.spinner)
|
||||
if err != nil {
|
||||
return nil
|
||||
}
|
||||
return tea.Subs{
|
||||
"tick": sub,
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue