mirror of
https://github.com/taigrr/bubbletea.git
synced 2026-04-14 16:51: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:
@@ -22,10 +22,7 @@ func main() {
|
||||
tea.UseSysLog("tea")
|
||||
|
||||
p := tea.NewProgram(
|
||||
Model{
|
||||
Input: input.DefaultModel(),
|
||||
Error: nil,
|
||||
},
|
||||
initialize,
|
||||
update,
|
||||
view,
|
||||
[]tea.Sub{
|
||||
@@ -46,6 +43,13 @@ func main() {
|
||||
}
|
||||
}
|
||||
|
||||
func initialize() (tea.Model, tea.Cmd) {
|
||||
return Model{
|
||||
Input: input.DefaultModel(),
|
||||
Error: nil,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func update(msg tea.Msg, model tea.Model) (tea.Model, tea.Cmd) {
|
||||
var cmd tea.Cmd
|
||||
m, ok := model.(Model)
|
||||
|
||||
Reference in New Issue
Block a user