forked from Mirrors/bubbletea
chore: don't shadow 'handler' type
This commit is contained in:
parent
5bc2504690
commit
c08461c8bd
13
tea.go
13
tea.go
|
@ -100,18 +100,19 @@ const (
|
||||||
withoutCatchPanics
|
withoutCatchPanics
|
||||||
)
|
)
|
||||||
|
|
||||||
// handlers manages series of channels returned by various processes. It allows
|
// channelHandlers manages the series of channels returned by various processes.
|
||||||
// us to wait for those processes to terminate before exiting the program.
|
// It allows us to wait for those processes to terminate before exiting the
|
||||||
type handlers []chan struct{}
|
// program.
|
||||||
|
type channelHandlers []chan struct{}
|
||||||
|
|
||||||
// Adds a channel to the list of handlers. We wait for all handlers to terminate
|
// Adds a channel to the list of handlers. We wait for all handlers to terminate
|
||||||
// gracefully on shutdown.
|
// gracefully on shutdown.
|
||||||
func (h *handlers) add(ch chan struct{}) {
|
func (h *channelHandlers) add(ch chan struct{}) {
|
||||||
*h = append(*h, ch)
|
*h = append(*h, ch)
|
||||||
}
|
}
|
||||||
|
|
||||||
// shutdown waits for all handlers to terminate.
|
// shutdown waits for all handlers to terminate.
|
||||||
func (h handlers) shutdown() {
|
func (h channelHandlers) shutdown() {
|
||||||
var wg sync.WaitGroup
|
var wg sync.WaitGroup
|
||||||
for _, ch := range h {
|
for _, ch := range h {
|
||||||
wg.Add(1)
|
wg.Add(1)
|
||||||
|
@ -406,7 +407,7 @@ func (p *Program) eventLoop(model Model, cmds chan Cmd) (Model, error) {
|
||||||
// terminated by either [Program.Quit], [Program.Kill], or its signal handler.
|
// terminated by either [Program.Quit], [Program.Kill], or its signal handler.
|
||||||
// Returns the final model.
|
// Returns the final model.
|
||||||
func (p *Program) Run() (Model, error) {
|
func (p *Program) Run() (Model, error) {
|
||||||
handlers := handlers{}
|
handlers := channelHandlers{}
|
||||||
cmds := make(chan Cmd)
|
cmds := make(chan Cmd)
|
||||||
p.errs = make(chan error)
|
p.errs = make(chan error)
|
||||||
p.finished = make(chan struct{}, 1)
|
p.finished = make(chan struct{}, 1)
|
||||||
|
|
Loading…
Reference in New Issue