mirror of
https://github.com/taigrr/bubbletea.git
synced 2026-04-02 02:59:09 -07:00
Convert remaining examples to Model interface-based structure
This commit is contained in:
@@ -27,10 +27,6 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
// Messages are events that we respond to in our Update function. This
|
||||
// particular one indicates that the timer has ticked.
|
||||
type tickMsg time.Time
|
||||
|
||||
// A model can be more or less any type of data. It holds all the data for a
|
||||
// program, so often it's a struct. For this simple example, however, all
|
||||
// we'll need is a simple integer.
|
||||
@@ -66,6 +62,10 @@ func (m model) View() string {
|
||||
return fmt.Sprintf("Hi. This program will exit in %d seconds. To quit sooner press any key.\n", m)
|
||||
}
|
||||
|
||||
// Messages are events that we respond to in our Update function. This
|
||||
// particular one indicates that the timer has ticked.
|
||||
type tickMsg time.Time
|
||||
|
||||
func tick() tea.Msg {
|
||||
time.Sleep(time.Second)
|
||||
return tickMsg{}
|
||||
|
||||
Reference in New Issue
Block a user