Skip to content

Commit

Permalink
Add program-level quit convenience method
Browse files Browse the repository at this point in the history
  • Loading branch information
meowgorithm committed Oct 4, 2021
1 parent 0b45391 commit 2dfc3ec
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions tea.go
Original file line number Diff line number Diff line change
Expand Up @@ -552,6 +552,20 @@ func (p *Program) Send(msg Msg) {
}
}

// Quit is a convenience function for quitting Bubble Tea programs. Use it
// when you need to shut down a Bubble Tea program from the outside.
//
// If you wish to quit from within a Bubble Tea program use the Quit command.
//
// If the program is not running this will be a no-op, so it's safe to call
// if the program is unstarted or has already exited.
//
// This method is currently provisional. The method signature may alter
// slightly, or it may be removed in a future version of this package.
func (p *Program) Quit() {
p.Send(Quit())
}

// shutdown performs operations to free up resources and restore the terminal
// to its original state.
func (p *Program) shutdown(kill bool) {
Expand Down

0 comments on commit 2dfc3ec

Please sign in to comment.