More refactoring.
This commit is contained in:
parent
6480ddf20d
commit
185c8fc1f8
2 changed files with 13 additions and 3 deletions
|
@ -141,7 +141,4 @@ func (widget *ReplyWidget) Serve(c *Context) {
|
|||
}
|
||||
}
|
||||
|
||||
type DynamicReplyWidget struct {
|
||||
|
||||
}
|
||||
|
||||
|
|
13
tg/widget.go
13
tg/widget.go
|
@ -5,6 +5,15 @@ import (
|
|||
//"fmt"
|
||||
)
|
||||
|
||||
type Maker[V any] interface {
|
||||
Make(*Context) V
|
||||
}
|
||||
|
||||
type MakeFunc[V any] func(*Context) V
|
||||
func (fn MakeFunc[V]) Make(c *Context) V {
|
||||
return fn(c)
|
||||
}
|
||||
|
||||
type ArgMap = map[string] any
|
||||
type ArgSlice = []any
|
||||
type ArgList[V any] []V
|
||||
|
@ -20,6 +29,10 @@ type Widget interface {
|
|||
Serve(*Context)
|
||||
}
|
||||
|
||||
type DynamicWidget[W Widget] interface {
|
||||
Maker[W]
|
||||
}
|
||||
|
||||
// Implementing the interface provides ability to
|
||||
// be used as the root widget for contexts.
|
||||
type RootWidget interface {
|
||||
|
|
Loading…
Reference in a new issue