Init function can return an error.
This commit is contained in:
parent
7f9f10075f
commit
6a71720b71
@ -24,5 +24,5 @@ type Control interface {
|
|||||||
type RootControl interface {
|
type RootControl interface {
|
||||||
Control
|
Control
|
||||||
|
|
||||||
Init(Context)
|
Init(Context) error
|
||||||
}
|
}
|
||||||
|
5
ui/ui.go
5
ui/ui.go
@ -16,7 +16,10 @@ func RunWait(r Renderer, s *Style, view Control, wait bool) error {
|
|||||||
ctx := &context{r: r, style: s, view: view, ims: NewImages(r)}
|
ctx := &context{r: r, style: s, view: view, ims: NewImages(r)}
|
||||||
root, ok := view.(RootControl)
|
root, ok := view.(RootControl)
|
||||||
if ok {
|
if ok {
|
||||||
root.Init(ctx)
|
err := root.Init(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
anim := time.NewTicker(30 * time.Millisecond)
|
anim := time.NewTicker(30 * time.Millisecond)
|
||||||
go func() {
|
go func() {
|
||||||
|
Loading…
Reference in New Issue
Block a user