Update Program.Start docs to indicate it's a blocking operation

This addresses one of the concerns in #299.
This commit is contained in:
Leandro López (inkel)
2022-10-03 22:56:52 -03:00
committed by Christian Muehlhaeuser
parent 9bde73bd4e
commit 8b8fd12201

8
tea.go
View File

@@ -335,7 +335,9 @@ func (p *Program) eventLoop(model Model, cmds chan Cmd) (Model, error) {
}
}
// StartReturningModel initializes the program. Returns the final model.
// StartReturningModel initializes the program and runs its event loops,
// blocking until it gets terminated by either [Program.Quit], [Program.Kill],
// or its signal handler. Returns the final model.
func (p *Program) StartReturningModel() (Model, error) {
handlers := handlers{}
cmds := make(chan Cmd)
@@ -473,7 +475,9 @@ func (p *Program) StartReturningModel() (Model, error) {
return model, err
}
// Start initializes the program. Ignores the final model.
// Start initializes the program and runs its event loops, blocking until it
// gets terminated by either [Program.Quit], [Program.Kill], or its signal
// handler.
func (p *Program) Start() error {
_, err := p.StartReturningModel()
return err