Documentation ¶
Index ¶
- Variables
- func ContainsString(s []string, e string) bool
- func DeleteLayout(uid string)
- func Exists(name string) bool
- func FileToString(name string) (string, error)
- func HandleRecover()
- func HandleRecoverMsg(msg string)
- func HandleRecoverPass()
- func Join(ids ...string)
- func New[T Component](id string, c T) T
- func SendToAllLayouts(msg interface{})
- func SendToLayouts(msg interface{}, uuids ...string)
- func StringToFile(filenanme string, content string) error
- type BiMap
- func (b *BiMap[T1, T2]) Delete(key T1)
- func (b *BiMap[T1, T2]) DeleteByValue(value T2)
- func (b *BiMap[T1, T2]) Get(key T1) (T2, bool)
- func (b *BiMap[T1, T2]) GetAll() map[T1]T2
- func (b *BiMap[T1, T2]) GetAllValues() map[T2]T1
- func (b *BiMap[T1, T2]) GetByValue(value T2) (T1, bool)
- func (b *BiMap[T1, T2]) Set(key T1, value T2)
- type Component
- type ComponentDriver
- func (cw *ComponentDriver[T]) AddNode(id string, value string)
- func (cw *ComponentDriver[T]) Commit()
- func (cw *ComponentDriver[T]) EvalScript(code string)
- func (cw *ComponentDriver[T]) ExecuteEvent(name string, data interface{})
- func (cw *ComponentDriver[T]) FillValue(value string)
- func (cw *ComponentDriver[T]) FillValueById(id string, value string)
- func (cw *ComponentDriver[T]) GetComponet() Component
- func (cw *ComponentDriver[T]) GetData() interface{}
- func (cw *ComponentDriver[T]) GetDriverById(id string) LiveDriver
- func (cw *ComponentDriver[T]) GetElementById(id string) string
- func (cw *ComponentDriver[T]) GetHTML() string
- func (cw *ComponentDriver[T]) GetID() string
- func (cw *ComponentDriver[T]) GetIDComponet() string
- func (cw *ComponentDriver[T]) GetPropertie(name string) string
- func (cw *ComponentDriver[T]) GetStyle(propertie string) string
- func (cw *ComponentDriver[T]) GetText() string
- func (cw *ComponentDriver[T]) GetValue() string
- func (cw *ComponentDriver[T]) Mount(component Component) LiveDriver
- func (cw *ComponentDriver[T]) MountWithStart(ws *websocket.Conn, id string, componentDriver LiveDriver) LiveDriver
- func (cw *ComponentDriver[T]) Remove(id string)
- func (cw *ComponentDriver[T]) SetData(data interface{})
- func (cw *ComponentDriver[T]) SetEvent(name string, fx func(c T, data interface{}))
- func (cw *ComponentDriver[T]) SetHTML(value string)
- func (cw *ComponentDriver[T]) SetID(id string)
- func (cw *ComponentDriver[T]) SetPropertie(propertie string, value interface{})
- func (cw *ComponentDriver[T]) SetStyle(style string)
- func (cw *ComponentDriver[T]) SetText(value string)
- func (cw *ComponentDriver[T]) SetValue(value interface{})
- func (cw *ComponentDriver[T]) StartDriver(ws *websocket.Conn, drivers *map[string]LiveDriver, ...)
- type Layout
- func (t *Layout) GetDriver() LiveDriver
- func (t *Layout) GetTemplate() string
- func (t *Layout) SetHandlerEventDestroy(fx func(id string))
- func (t *Layout) SetHandlerEventIn(fx func(data interface{}))
- func (t *Layout) SetHandlerEventTime(IntervalEventTime time.Duration, fx func())
- func (t *Layout) SetHandlerFirstTime(fx func())
- func (t *Layout) Start()
- type LiveDriver
- type None
- type PageControl
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func ContainsString ¶
func DeleteLayout ¶
func DeleteLayout(uid string)
func FileToString ¶
func HandleRecover ¶
func HandleRecover()
func HandleRecoverMsg ¶
func HandleRecoverMsg(msg string)
func HandleRecoverPass ¶
func HandleRecoverPass()
func SendToAllLayouts ¶
func SendToAllLayouts(msg interface{})
func SendToLayouts ¶
func SendToLayouts(msg interface{}, uuids ...string)
func StringToFile ¶
Types ¶
type BiMap ¶
type BiMap[T1 comparable, T2 comparable] struct { // contains filtered or unexported fields }
func NewBiMap ¶
func NewBiMap[T1 comparable, T2 comparable]() *BiMap[T1, T2]
func (*BiMap[T1, T2]) DeleteByValue ¶
func (b *BiMap[T1, T2]) DeleteByValue(value T2)
func (*BiMap[T1, T2]) GetAllValues ¶
func (b *BiMap[T1, T2]) GetAllValues() map[T2]T1
func (*BiMap[T1, T2]) GetByValue ¶
type Component ¶
type Component interface { // GetTemplate return html template for render with component in the {{.}} GetTemplate() string // Start it will invoke in the mount time Start() GetDriver() LiveDriver }
Component it is interface for implement one component
type ComponentDriver ¶
type ComponentDriver[T Component] struct { Component T IdComponent string Conn *websocket.Conn DriversPage *map[string]LiveDriver // Events has rewrite of our implementings of events, examples click, change, keyup, keydown, etc Events map[string]func(c T, data interface{}) Data interface{} // contains filtered or unexported fields }
ComponentDriver this is the driver for component, with this struct we can execute our methods in the web
func NewDriver ¶
func NewDriver[T Component](id string, c T) *ComponentDriver[T]
Create Driver with component
func (*ComponentDriver[T]) AddNode ¶
func (cw *ComponentDriver[T]) AddNode(id string, value string)
AddNode add node to id
func (*ComponentDriver[T]) Commit ¶
func (cw *ComponentDriver[T]) Commit()
Commit render of component
func (*ComponentDriver[T]) EvalScript ¶
func (cw *ComponentDriver[T]) EvalScript(code string)
EvalScript execute eval($code);
func (*ComponentDriver[T]) ExecuteEvent ¶
func (cw *ComponentDriver[T]) ExecuteEvent(name string, data interface{})
ExecuteEvent execute events
func (*ComponentDriver[T]) FillValue ¶
func (cw *ComponentDriver[T]) FillValue(value string)
FillValue is same SetHTML
func (*ComponentDriver[T]) FillValueById ¶
func (cw *ComponentDriver[T]) FillValueById(id string, value string)
FillValue is same SetHTML
func (*ComponentDriver[T]) GetComponet ¶
func (cw *ComponentDriver[T]) GetComponet() Component
GetID return id of driver
func (*ComponentDriver[T]) GetData ¶
func (cw *ComponentDriver[T]) GetData() interface{}
func (*ComponentDriver[T]) GetDriverById ¶
func (cw *ComponentDriver[T]) GetDriverById(id string) LiveDriver
GetID return id of driver
func (*ComponentDriver[T]) GetElementById ¶
func (cw *ComponentDriver[T]) GetElementById(id string) string
GetElementById same as GetValue
func (*ComponentDriver[T]) GetHTML ¶
func (cw *ComponentDriver[T]) GetHTML() string
GetHTML return document.getElementById("$id").innerHTML
func (*ComponentDriver[T]) GetID ¶
func (cw *ComponentDriver[T]) GetID() string
GetID return id of driver
func (*ComponentDriver[T]) GetIDComponet ¶
func (cw *ComponentDriver[T]) GetIDComponet() string
func (*ComponentDriver[T]) GetPropertie ¶
func (cw *ComponentDriver[T]) GetPropertie(name string) string
GetPropertie return document.getElementById("$id")[$propertie]
func (*ComponentDriver[T]) GetStyle ¶
func (cw *ComponentDriver[T]) GetStyle(propertie string) string
GetStyle return document.getElementById("$id").style["$propertie"]
func (*ComponentDriver[T]) GetText ¶
func (cw *ComponentDriver[T]) GetText() string
GetText return document.getElementById("$id").innerText
func (*ComponentDriver[T]) GetValue ¶
func (cw *ComponentDriver[T]) GetValue() string
GetValue return document.getElementById("$id").value
func (*ComponentDriver[T]) Mount ¶
func (cw *ComponentDriver[T]) Mount(component Component) LiveDriver
Mount mount component in other component
func (*ComponentDriver[T]) MountWithStart ¶
func (cw *ComponentDriver[T]) MountWithStart(ws *websocket.Conn, id string, componentDriver LiveDriver) LiveDriver
Mount mount component in other component"mount_span_" +
func (*ComponentDriver[T]) SetData ¶
func (cw *ComponentDriver[T]) SetData(data interface{})
func (*ComponentDriver[T]) SetEvent ¶
func (cw *ComponentDriver[T]) SetEvent(name string, fx func(c T, data interface{}))
func (*ComponentDriver[T]) SetHTML ¶
func (cw *ComponentDriver[T]) SetHTML(value string)
SetHTML is same FillValue :p haha, execute document.getElementById("$id").innerHTML = $value
func (*ComponentDriver[T]) SetID ¶
func (cw *ComponentDriver[T]) SetID(id string)
SetID set id of driver
func (*ComponentDriver[T]) SetPropertie ¶
func (cw *ComponentDriver[T]) SetPropertie(propertie string, value interface{})
SetPropertie execute document.getElementById("$id")[$propertie] = $value
func (*ComponentDriver[T]) SetStyle ¶
func (cw *ComponentDriver[T]) SetStyle(style string)
SetStyle execute document.getElementById("$id").style.cssText = $style
func (*ComponentDriver[T]) SetText ¶
func (cw *ComponentDriver[T]) SetText(value string)
SetText execute document.getElementById("$id").innerText = $value
func (*ComponentDriver[T]) SetValue ¶
func (cw *ComponentDriver[T]) SetValue(value interface{})
SetValue execute document.getElementById("$id").value = $value|
func (*ComponentDriver[T]) StartDriver ¶
func (cw *ComponentDriver[T]) StartDriver(ws *websocket.Conn, drivers *map[string]LiveDriver, channelIn *map[string]chan interface{})
type Layout ¶
type Layout struct { *ComponentDriver[*Layout] UUID string Html string HandlerEventIn func(data interface{}) HandlerEventTime func() HandlerEventDestroy func(id string) HandlerInternalDestroy func() HandlerFirstTime func() IntervalEventTime time.Duration }
func (*Layout) GetDriver ¶
func (t *Layout) GetDriver() LiveDriver
func (*Layout) GetTemplate ¶
func (*Layout) SetHandlerEventDestroy ¶
func (*Layout) SetHandlerEventIn ¶
func (t *Layout) SetHandlerEventIn(fx func(data interface{}))
func (*Layout) SetHandlerEventTime ¶
func (*Layout) SetHandlerFirstTime ¶
func (t *Layout) SetHandlerFirstTime(fx func())
type LiveDriver ¶
type LiveDriver interface { GetID() string SetID(string) StartDriver(*websocket.Conn, *map[string]LiveDriver, *map[string]chan interface{}) GetIDComponet() string ExecuteEvent(name string, data interface{}) GetComponet() Component Mount(component Component) LiveDriver MountWithStart(ws *websocket.Conn, id string, componentDriver LiveDriver) LiveDriver Commit() Remove(string) AddNode(string, string) FillValue(string) SetHTML(string) SetText(string) SetPropertie(string, interface{}) SetValue(interface{}) EvalScript(string) SetStyle(string) FillValueById(id string, value string) GetPropertie(string) string GetDriverById(id string) LiveDriver GetText() string GetHTML() string GetStyle(string) string GetValue() string GetElementById(string) string SetData(interface{}) }
type None ¶
type None struct { *ComponentDriver[*None] Template string }
func NewWithTemplate ¶
func (*None) GetDriver ¶
func (t *None) GetDriver() LiveDriver
func (*None) GetTemplate ¶
type PageControl ¶
type PageControl struct { Path string Title string HeadCode string Lang string Css string LiveJs string AfterCode string Router fiber.Router Debug bool }
func (*PageControl) Register ¶
func (pc *PageControl) Register(fx func() LiveDriver)
Register this method to register in router of Echo page and websocket