mirror of
https://github.com/taigrr/bubbletea.git
synced 2026-04-02 02:59:09 -07:00
Programs should take an init type/function as the first argument
This is in line with the way Elm works. Also update examples.
This commit is contained in:
@@ -28,7 +28,7 @@ type frameMsg struct{}
|
||||
|
||||
func main() {
|
||||
p := tea.NewProgram(
|
||||
Model{0, false, 10, 0, 0, false},
|
||||
initialize,
|
||||
update,
|
||||
view,
|
||||
[]tea.Sub{tick, frame},
|
||||
@@ -38,6 +38,12 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
// INIT
|
||||
|
||||
func initialize() (tea.Model, tea.Cmd) {
|
||||
return Model{0, false, 10, 0, 0, false}, nil
|
||||
}
|
||||
|
||||
// SUBSCRIPTIONS
|
||||
|
||||
func tick(model tea.Model) tea.Msg {
|
||||
|
||||
Reference in New Issue
Block a user