tg/go.go

33 lines
507 B
Go

package tg
func Go(pth Widget) UI {
return UI{
WidgetGo{
Path: pth,
},
}
}
// The type implements changing current path to the widget.
type WidgetGo struct {
Path Widget
Arg any
}
func (sc WidgetGo) Act(c Context) {
c.GoWithArg(sc.Path, sc.Arg)
}
// Implementing the Server interface.
func (widget WidgetGo) Serve(c Context) {
c.input.Close()
c.Go(widget)
}
func (widget WidgetGo) Render(c Context) UI {
return UI{widget}
}
func (widget WidgetGo) Filter(u Update) bool {
return true
}