Skip to content
Myr

Update spinner example so it works with the spinner version in master

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Christian Rocha · committed by Christian Rocha · parent 2a82e2a · Browse files · 1 file+11 added−9 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+11 added−9 removed

  • other:+11 added−9 removed

1 file+11 added−9 removed

modified:examples/spinner/main.go+11 added-9 removed
1package main23import (4 "errors"4 "fmt"5 "log"67 "github.com/charmbracelet/tea"
73 unmodified lines
81 String()82 return fmt.Sprintf("\n\n %s Loading forever...press q to quit\n\n", s)83}8486func subscriptions(_ tea.Model) tea.Subs {85func subscriptions(model tea.Model) tea.Subs {86 m, ok := model.(Model)87 if !ok {88 return nil89 }9091 sub, err := spinner.MakeSub(m.spinner)92 if err != nil {93 return nil94 }95 return tea.Subs{88 "tick": func(model tea.Model) tea.Msg {89 m, ok := model.(Model)90 if !ok {91 return errMsg(errors.New("could perform assertion on model in subscription"))92 }93 return spinner.Sub(m.spinner)94 },96 "tick": sub,97 }98}