Documentation
¶
Overview ¶
package widget: Widget is inner representation of functionality, that connects web and server part.
Index ¶
- Variables
- func InitChildren(ctx context.Context, w Widget) error
- func MustSurvive(err error) struct{}
- func RegisterWidgetType(w Widget, tmplstring string) error
- type BaseWidget
- func (w *BaseWidget) Base() *BaseWidget
- func (w *BaseWidget) Children() map[string]Widget
- func (w *BaseWidget) Dispatch(ctx context.Context, event string) error
- func (w *BaseWidget) Errorf(f string, args ...any) error
- func (w *BaseWidget) Init(ctx context.Context) error
- func (w *BaseWidget) InitStage1(ctx context.Context) error
- func (w *BaseWidget) RenderTo(ctx context.Context, wr io.Writer) error
- func (w *BaseWidget) Send(msg string) error
- func (w *BaseWidget) SendChan() chan string
- type Button
- type ButtonArgs
- type Clock
- type Config
- type Container
- type Eval
- type HrBr
- type Label
- type ObsRecord
- type ObsRecordInfo
- type ObsStream
- type ObsStreamInfo
- type RawHTML
- type Scenes
- type Widget
- type Youtube
Constants ¶
This section is empty.
Variables ¶
View Source
var TemplateRegistry = make(map[string]*template.Template) // typename => html.template
View Source
var TypeRegistry = make(map[string]reflect.Type) // typename => widgettype
Functions ¶
func InitChildren ¶ added in v1.0.3
TODO may be VisitChildren()
func MustSurvive ¶
func MustSurvive(err error) struct{}
func RegisterWidgetType ¶
Types ¶
type BaseWidget ¶
type BaseWidget struct {
Config
Widget Widget // link to actual widget object
Chan chan string // channel to interact with visual representation
Log zerolog.Logger // logger for specified widget
}
func (*BaseWidget) Base ¶
func (w *BaseWidget) Base() *BaseWidget
func (*BaseWidget) Children ¶ added in v1.0.3
func (w *BaseWidget) Children() map[string]Widget
func (*BaseWidget) Dispatch ¶ added in v1.0.2
func (w *BaseWidget) Dispatch(ctx context.Context, event string) error
Consume websocket message in separate goroutine
func (*BaseWidget) InitStage1 ¶ added in v1.0.3
func (w *BaseWidget) InitStage1(ctx context.Context) error
func (*BaseWidget) Send ¶
func (w *BaseWidget) Send(msg string) error
func (*BaseWidget) SendChan ¶ added in v1.0.2
func (w *BaseWidget) SendChan() chan string
type Button ¶
type Button struct {
BaseWidget
Args ButtonArgs
}
type ButtonArgs ¶
type Clock ¶
type Clock struct {
BaseWidget
Format string
}
type Container ¶ added in v1.0.2
type Container struct {
BaseWidget
// registry part
Map map[string]Widget // contained widgets
Order []string // order which widgets was in config
Len int // count of widgets
}
type Eval ¶ added in v1.0.3
type Eval struct {
BaseWidget
}
type HrBr ¶
type HrBr struct {
BaseWidget
}
type Label ¶
type Label struct {
BaseWidget
}
type ObsRecordInfo ¶
type ObsStream ¶
type ObsStream struct {
BaseWidget
}
type ObsStreamInfo ¶
type Scenes ¶ added in v1.0.2
type Scenes struct {
BaseWidget
}
type Widget ¶
type Widget interface {
Init(ctx context.Context) error // init widget with config in it's base
Dispatch(ctx context.Context, event string) error // consume one event from Websocket
RenderTo(ctx context.Context, wr io.Writer) error // render visual representation
SendChan() chan string // get channel where out messages is
Send(event string) error // Send something to all my visual representations
Base() *BaseWidget // access to common data
Children() map[string]Widget // get all children
}
Click to show internal directories.
Click to hide internal directories.