Check for error in subscription and update Tea dependency

This commit is contained in:
Christian Rocha
2020-01-25 22:22:57 -05:00
parent c83a0bee59
commit 419df0b7a2
3 changed files with 9 additions and 4 deletions

View File

@@ -90,7 +90,10 @@ func cursor(s string, blink bool) string {
// Subscription
func Blink(model tea.Model) tea.Msg {
m, _ := model.(Model)
m, ok := model.(Model)
if !ok {
return tea.NewErrMsg("could not assert given model to the model we expected; make sure you're passing as input model")
}
time.Sleep(m.BlinkSpeed)
return CursorBlinkMsg{}
}