Update subs for Tea v0.2.1. That is to say, remove the their arguments.

This commit is contained in:
Christian Rocha
2020-05-04 18:54:26 -04:00
parent 6c2e144255
commit da64445a0e
3 changed files with 31 additions and 15 deletions

View File

@@ -154,14 +154,24 @@ func updateInputs(msg tea.Msg, m Model) Model {
}
func subscriptions(model tea.Model) tea.Subs {
m, ok := model.(Model)
if !ok {
return nil
}
// It's a little hacky, but we're using the subscription from one
// input element to handle the blinking for all elements. It doesn't
// have to be this way, we're just feeling a bit lazy at the moment.
inputSub, err := input.MakeSub(m.nameInput)
if err != nil {
return nil
}
return tea.Subs{
// It's a little hacky, but we're using the subscription from one
// input element to handle the blinking for all elements. It doesn't
// have to be this way, we're just feeling a bit lazy at the moment.
"blink": func(model tea.Model) tea.Msg {
m, _ := model.(Model)
return input.Blink(m.nameInput)
},
"blink": inputSub,
}
}