Documentation
¶
Index ¶
- Variables
- func MustSurvive(err error) struct{}
- func NewRegistry(ctx context.Context, confs []map[string]any) types.WidgetRegistry
- func RegisterWidgetType(w Widget, tmplstring string) error
- type BaseWidget
- func (w *BaseWidget) Actual() Widget
- func (w *BaseWidget) Base() *BaseWidget
- func (w *BaseWidget) Consume(ctx context.Context, event []byte) error
- func (w *BaseWidget) Errorf(f string, args ...any) error
- func (w *BaseWidget) Init(context.Context) error
- func (w *BaseWidget) RenderTo(wr io.Writer) error
- func (w *BaseWidget) Send(msg string) error
- type Button
- type ButtonArgs
- type Clock
- type Config
- type HrBr
- type Label
- type ObsRecord
- type ObsRecordInfo
- type ObsStream
- type ObsStreamInfo
- type Registry
- type Widget
Constants ¶
This section is empty.
Variables ¶
View Source
var SendChan = make(chan string)
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 MustSurvive ¶
func MustSurvive(err error) struct{}
func NewRegistry ¶
func RegisterWidgetType ¶
Types ¶
type BaseWidget ¶
func (*BaseWidget) Actual ¶
func (w *BaseWidget) Actual() Widget
func (*BaseWidget) Base ¶
func (w *BaseWidget) Base() *BaseWidget
func (*BaseWidget) Consume ¶
func (w *BaseWidget) Consume(ctx context.Context, event []byte) error
Consume websocket message in separate goroutine
func (*BaseWidget) Send ¶
func (w *BaseWidget) Send(msg string) error
type Button ¶
type Button struct {
BaseWidget
Args ButtonArgs
}
type ButtonArgs ¶
type Clock ¶
type Clock struct {
BaseWidget
Format string
}
type HrBr ¶
type HrBr struct {
BaseWidget
}
type Label ¶
type Label struct {
BaseWidget
}
type ObsRecord ¶
type ObsRecord struct {
BaseWidget
}
type ObsRecordInfo ¶
type ObsStream ¶
type ObsStream struct {
BaseWidget
}
type ObsStreamInfo ¶
type Registry ¶
type Registry struct {
Map map[string]Widget // Registered widgets
Order []string // order which widgets was in config
}
all of initialized widgets (from config)
type Widget ¶
type Widget interface {
Init(ctx context.Context) error // init widget with config in it's base
RenderTo(writer io.Writer) error // render visual representation
Consume(ctx context.Context, event []byte) error // consume one event from Websocket
Send(event string) error // Send something to all my visual representations
Base() *BaseWidget // access to common data
Actual() Widget // pointer to actual widget
}
Click to show internal directories.
Click to hide internal directories.