Documentation ¶
Index ¶
- func NewrateLimitedScreenUpdater(minDuration time.Duration, parent func(*DisplayUpdate)) *rateLimitedScreenUpdater
- type DefaultNotFoundScreen
- type DisplayModel
- func (m *DisplayModel) AppendChild(id string, child *DisplayModel)
- func (m *DisplayModel) DeepCopy() *DisplayModel
- func (m *DisplayModel) DeepEqual(other *DisplayModel) bool
- func (m *DisplayModel) DeleteChild(id string)
- func (m *DisplayModel) FindElementByID(id string) *DisplayModel
- func (m *DisplayModel) FindElementPathByID(id string) *[]int
- func (m *DisplayModel) ReplaceChild(id string, replacement *DisplayModel) *DisplayModel
- func (m *DisplayModel) ReplaceElementWithPath(path []int, replacement *DisplayModel)
- func (m *DisplayModel) SetElementAttribute(id, name string, value interface{})
- func (m *DisplayModel) SetElementText(id, text string) *DisplayModel
- type DisplayUpdate
- type Reactor
- type ReportEvent
- type Screen
- type ScreenContext
- type ScreenFactory
- type UserEvent
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewrateLimitedScreenUpdater ¶
func NewrateLimitedScreenUpdater(minDuration time.Duration, parent func(*DisplayUpdate)) *rateLimitedScreenUpdater
Types ¶
type DefaultNotFoundScreen ¶
type DefaultNotFoundScreen struct {
// contains filtered or unexported fields
}
func (*DefaultNotFoundScreen) Mount ¶
func (d *DefaultNotFoundScreen) Mount()
func (*DefaultNotFoundScreen) OnUserEvent ¶
func (d *DefaultNotFoundScreen) OnUserEvent(*UserEvent)
func (*DefaultNotFoundScreen) Unmount ¶
func (d *DefaultNotFoundScreen) Unmount()
type DisplayModel ¶
type DisplayModel struct { ID string `json:"id,omitempty"` Element string `json:"el,omitempty"` Text string `json:"te,omitempty"` Children []*DisplayModel `json:"ch,omitempty"` Attributes map[string]interface{} `json:"at,omitempty"` ReportEvents []ReportEvent `json:"ev,omitempty"` }
func MustParseDisplayModel ¶
func MustParseDisplayModel(src string) *DisplayModel
func ParseDisplayModel ¶
func ParseDisplayModel(src string) (*DisplayModel, error)
func (*DisplayModel) AppendChild ¶
func (m *DisplayModel) AppendChild(id string, child *DisplayModel)
func (*DisplayModel) DeepCopy ¶
func (m *DisplayModel) DeepCopy() *DisplayModel
func (*DisplayModel) DeepEqual ¶
func (m *DisplayModel) DeepEqual(other *DisplayModel) bool
func (*DisplayModel) DeleteChild ¶
func (m *DisplayModel) DeleteChild(id string)
func (*DisplayModel) FindElementByID ¶
func (m *DisplayModel) FindElementByID(id string) *DisplayModel
func (*DisplayModel) FindElementPathByID ¶
func (m *DisplayModel) FindElementPathByID(id string) *[]int
func (*DisplayModel) ReplaceChild ¶
func (m *DisplayModel) ReplaceChild(id string, replacement *DisplayModel) *DisplayModel
func (*DisplayModel) ReplaceElementWithPath ¶
func (m *DisplayModel) ReplaceElementWithPath(path []int, replacement *DisplayModel)
func (*DisplayModel) SetElementAttribute ¶
func (m *DisplayModel) SetElementAttribute(id, name string, value interface{})
func (*DisplayModel) SetElementText ¶
func (m *DisplayModel) SetElementText(id, text string) *DisplayModel
type DisplayUpdate ¶
type DisplayUpdate struct { Model *DisplayModel `json:"model,omitempty"` Eval string `json:"eval,omitempty"` Title string `json:"title,omitempty"` Location string `json:"location,omitempty"` }
func (*DisplayUpdate) DeepEqual ¶
func (d *DisplayUpdate) DeepEqual(other *DisplayUpdate) bool
type Reactor ¶
func (*Reactor) AddScreen ¶
func (r *Reactor) AddScreen(pathPattern string, factory ScreenFactory) error
func (*Reactor) RemoveScreens ¶
func (r *Reactor) RemoveScreens()
func (*Reactor) ServeHTTP ¶
func (re *Reactor) ServeHTTP(rw http.ResponseWriter, r *http.Request, next http.HandlerFunc)
type ReportEvent ¶
type Screen ¶
type Screen interface { Mount() OnUserEvent(*UserEvent) Unmount() }
func DefaultNotFoundScreenFactory ¶
func DefaultNotFoundScreenFactory(ctx ScreenContext) Screen
type ScreenContext ¶
type ScreenContext struct { Path string ConnectionID string Params map[string]string UpdateScreen func(*DisplayUpdate) }
type ScreenFactory ¶
type ScreenFactory func(ScreenContext) Screen
type UserEvent ¶
type UserEvent struct { ElementID string `json:"id,omitempty"` Type string `json:"type,omitempty"` Value string `json:"value,omitempty"` Data string `json:"data,omitempty"` ExtraValues map[string]interface{} `json:"xv,omitempty"` }
UserEvent is an event triggered by the client. Such as click, or key events.
Source Files ¶
Click to show internal directories.
Click to hide internal directories.