33 lines
531 B
Go
33 lines
531 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 (w WidgetGo) Act(c Context) {
|
|
c.WithArg(w.Arg).Go(w.Path)
|
|
}
|
|
|
|
// Implementing the Server interface.
|
|
func (widget WidgetGo) Serve(c Context) {
|
|
c.input.Close()
|
|
c.WithArg(widget.Path).Go(widget.Path)
|
|
}
|
|
|
|
func (widget WidgetGo) Render(c Context) UI {
|
|
return UI{widget}
|
|
}
|
|
|
|
func (widget WidgetGo) Filter(u Update) bool {
|
|
return true
|
|
}
|