Documentation ¶
Index ¶
- Constants
- Variables
- func Focus() l.Attributer
- func FocusRemove(tag l.Adder)
- func InstallPubSub(pubSub *PubSub) hlive.Attributer
- func OnDiffApply(handler l.EventHandler) *l.ElementGroup
- func OnDiffApplyOnce(handler l.EventHandler) *l.ElementGroup
- func PreemptDisableOn(eb *l.EventBinding) *l.ElementGroup
- func Redirect(url string) l.Attributer
- func ScrollTop(val int) l.Attributer
- func ScrollTopRemove(tag l.Adder)
- type CacheRistretto
- type ComponentGetNodes
- type ComponentList
- type ComponentListSimple
- type ComponentPubSub
- func (c *ComponentPubSub) AfterPubSubMount(ctx context.Context, pubSub *PubSub)
- func (c *ComponentPubSub) PubSubMount(ctx context.Context, pubSub *PubSub)
- func (c *ComponentPubSub) SetAfterMountPubSub(f func(ctx context.Context, pubSub *PubSub))
- func (c *ComponentPubSub) SetMountPubSub(f func(ctx context.Context, pubSub *PubSub))
- type DiffApplyAttribute
- type FocusAttribute
- type PreemptDisableAttribute
- type PubSub
- func (ps *PubSub) Publish(topic string, value any)
- func (ps *PubSub) Subscribe(sub QueueSubscriber, topics ...string)
- func (ps *PubSub) SubscribeFunc(subFunc func(message QueueMessage), topics ...string) SubscribeFunc
- func (ps *PubSub) SubscribeWait(sub QueueSubscriber, topics ...string)
- func (ps *PubSub) SubscribeWaitFunc(subFunc func(message QueueMessage), topics ...string) SubscribeFunc
- func (ps *PubSub) Unsubscribe(sub QueueSubscriber, topics ...string)
- func (ps *PubSub) UnsubscribeWait(sub QueueSubscriber, topics ...string)
- type PubSubAfterMounter
- type PubSubAttribute
- type PubSubMounter
- type PubSubSSRMounter
- type QueueMessage
- type QueueSubscriber
- type RedirectAttribute
- type ScrollTopAttribute
- type SubscribeFunc
Constants ¶
const ( DiffApplyEvent = "diffapply" DiffApplyAttributeName = "data-hlive-on-diffapply" )
const FocusAttributeName = "data-hlive-focus"
const PipelineProcessorKeyPubSubMount = "hlivekit_ps_mount"
const (
PreemptDisableAttributeName = "data-hlive-pre-disable"
)
const PubSubAttributeName = "data-hlive-pubsub"
const RedirectAttributeName = "data-redirect"
const ScrollTopAttributeName = "data-scrollTop"
Variables ¶
var DiffApplyScript []byte
var ErrInvalidListAdd = errors.New("value is not valid for a list")
var FocusJavaScript []byte
var PreemptDisableOnClickJavaScript []byte
var RedirectJavaScript []byte
var ScrollTopJavaScript []byte
Functions ¶
func Focus ¶
func Focus() l.Attributer
func FocusRemove ¶
func InstallPubSub ¶
func InstallPubSub(pubSub *PubSub) hlive.Attributer
func OnDiffApply ¶
func OnDiffApply(handler l.EventHandler) *l.ElementGroup
func OnDiffApplyOnce ¶
func OnDiffApplyOnce(handler l.EventHandler) *l.ElementGroup
TODO: how we remove the attribute once done?
func Redirect ¶
func Redirect(url string) l.Attributer
func ScrollTop ¶
func ScrollTop(val int) l.Attributer
func ScrollTopRemove ¶
Types ¶
type CacheRistretto ¶ added in v0.2.0
type CacheRistretto struct {
// contains filtered or unexported fields
}
CacheRistretto cache adapter for Ristretto
func NewCacheRistretto ¶ added in v0.2.0
func NewCacheRistretto(cache *ristretto.Cache) *CacheRistretto
func (*CacheRistretto) Set ¶ added in v0.2.0
func (c *CacheRistretto) Set(key any, value any)
type ComponentGetNodes ¶
type ComponentGetNodes struct { *hlive.ComponentMountable GetNodesFunc func() *hlive.NodeGroup }
ComponentGetNodes add a custom GetNodes function to ComponentMountable
func CGN ¶
func CGN(name string, getNodesFunc func() *hlive.NodeGroup, elements ...any) *ComponentGetNodes
CGN is a shortcut for NewComponentGetNodes
func NewComponentGetNodes ¶
func NewComponentGetNodes(name string, getNodesFunc func() *hlive.NodeGroup, elements ...any) *ComponentGetNodes
func (*ComponentGetNodes) GetNodes ¶
func (c *ComponentGetNodes) GetNodes() *hlive.NodeGroup
type ComponentList ¶
type ComponentList struct {
*ComponentListSimple
}
ComponentList is a way to manage a dynamic collection of Teardowner Node values. For example, the rows of a table.
As the Node values in ComponentList are often added and removed there lies the possibility of memory leaks. To prevent this the items in the list must be Teardowner values. The list will call Teardown on each item as long as they are removed using its RemoveItem and RemoveAllItems functions.
See NewComponentMountable, CM, WrapMountable, and WM for help with creating Teardowner values.
func List ¶
func List(name string, elements ...any) *ComponentList
List is a shortcut for NewComponentList.
func NewComponentList ¶
func NewComponentList(name string, elements ...any) *ComponentList
NewComponentList returns a value of ComponentList
func (*ComponentList) Add ¶
func (list *ComponentList) Add(elements ...any)
Add an element to this Component.
You can add Groups, Teardowner, EventBinding, or None Node Elements
func (*ComponentList) AddItem ¶
func (list *ComponentList) AddItem(items ...l.Teardowner)
AddItem allows you to add a node to the list
Add nodes are often added and removed nodes needed to be a Teardowner. See NewComponentMountable, CM, WrapMountable, and WM for help with creating Teardowner values.
func (*ComponentList) RemoveAllItems ¶
func (list *ComponentList) RemoveAllItems()
RemoveAllItems empties the list of items and calls Teardown on each of them.
func (*ComponentList) RemoveItems ¶
func (list *ComponentList) RemoveItems(items ...l.Teardowner)
RemoveItems will remove a Teardowner can call its Teardown function.
type ComponentListSimple ¶
type ComponentListSimple struct { *l.ComponentMountable // contains filtered or unexported fields }
ComponentListSimple is a version of ComponentList that doesn't have the Teardown logic
func NewComponentListSimple ¶
func NewComponentListSimple(name string, elements ...any) *ComponentListSimple
NewComponentListSimple creates a ComponentListSimple value
func (*ComponentListSimple) Add ¶
func (list *ComponentListSimple) Add(elements ...any)
Add an element to this ComponentListSimple.
You can add Groups, UniqueTagger, EventBinding, or None Node Elements
func (*ComponentListSimple) AddItems ¶
func (list *ComponentListSimple) AddItems(items ...l.UniqueTagger)
func (*ComponentListSimple) GetNodes ¶
func (list *ComponentListSimple) GetNodes() *l.NodeGroup
GetNodes returns the list of items.
func (*ComponentListSimple) RemoveAllItems ¶
func (list *ComponentListSimple) RemoveAllItems()
func (*ComponentListSimple) RemoveItems ¶
func (list *ComponentListSimple) RemoveItems(items ...l.UniqueTagger)
type ComponentPubSub ¶
type ComponentPubSub struct { *hlive.ComponentMountable // contains filtered or unexported fields }
ComponentPubSub add PubSub to ComponentMountable
func CPS ¶
func CPS(name string, elements ...any) *ComponentPubSub
CPS is a shortcut for NewComponentPubSub
func NewComponentPubSub ¶
func NewComponentPubSub(name string, elements ...any) *ComponentPubSub
func WCPS ¶ added in v0.2.1
func WCPS(name string, elements ...any) *ComponentPubSub
WCPS is a shortcut for WrapComponentPubSub
func WrapComponentPubSub ¶ added in v0.2.1
func WrapComponentPubSub(c *hlive.ComponentMountable) *ComponentPubSub
func (*ComponentPubSub) AfterPubSubMount ¶ added in v0.2.0
func (c *ComponentPubSub) AfterPubSubMount(ctx context.Context, pubSub *PubSub)
func (*ComponentPubSub) PubSubMount ¶
func (c *ComponentPubSub) PubSubMount(ctx context.Context, pubSub *PubSub)
func (*ComponentPubSub) SetAfterMountPubSub ¶ added in v0.2.0
func (c *ComponentPubSub) SetAfterMountPubSub(f func(ctx context.Context, pubSub *PubSub))
func (*ComponentPubSub) SetMountPubSub ¶ added in v0.2.0
func (c *ComponentPubSub) SetMountPubSub(f func(ctx context.Context, pubSub *PubSub))
type DiffApplyAttribute ¶
func (*DiffApplyAttribute) Initialize ¶
func (a *DiffApplyAttribute) Initialize(page *l.Page)
func (*DiffApplyAttribute) InitializeSSR ¶
func (a *DiffApplyAttribute) InitializeSSR(page *l.Page)
type FocusAttribute ¶
func (*FocusAttribute) Initialize ¶
func (a *FocusAttribute) Initialize(page *l.Page)
func (*FocusAttribute) InitializeSSR ¶
func (a *FocusAttribute) InitializeSSR(page *l.Page)
type PreemptDisableAttribute ¶
func (*PreemptDisableAttribute) Initialize ¶
func (a *PreemptDisableAttribute) Initialize(page *l.Page)
func (*PreemptDisableAttribute) InitializeSSR ¶
func (a *PreemptDisableAttribute) InitializeSSR(page *l.Page)
type PubSub ¶
type PubSub struct {
// contains filtered or unexported fields
}
func (*PubSub) Subscribe ¶
func (ps *PubSub) Subscribe(sub QueueSubscriber, topics ...string)
func (*PubSub) SubscribeFunc ¶
func (ps *PubSub) SubscribeFunc(subFunc func(message QueueMessage), topics ...string) SubscribeFunc
func (*PubSub) SubscribeWait ¶ added in v0.2.0
func (ps *PubSub) SubscribeWait(sub QueueSubscriber, topics ...string)
func (*PubSub) SubscribeWaitFunc ¶ added in v0.2.0
func (ps *PubSub) SubscribeWaitFunc(subFunc func(message QueueMessage), topics ...string) SubscribeFunc
func (*PubSub) Unsubscribe ¶
func (ps *PubSub) Unsubscribe(sub QueueSubscriber, topics ...string)
func (*PubSub) UnsubscribeWait ¶ added in v0.2.0
func (ps *PubSub) UnsubscribeWait(sub QueueSubscriber, topics ...string)
type PubSubAfterMounter ¶ added in v0.2.0
type PubSubAfterMounter interface { PubSubMounter AfterPubSubMount(context.Context, *PubSub) }
type PubSubAttribute ¶
func (*PubSubAttribute) Initialize ¶
func (a *PubSubAttribute) Initialize(page *hlive.Page)
func (*PubSubAttribute) InitializeSSR ¶
func (a *PubSubAttribute) InitializeSSR(page *hlive.Page)
func (*PubSubAttribute) PipelineProcessorPubSub ¶
func (a *PubSubAttribute) PipelineProcessorPubSub() *hlive.PipelineProcessor
type PubSubMounter ¶
type PubSubSSRMounter ¶
type QueueMessage ¶
type QueueSubscriber ¶
type QueueSubscriber interface { GetID() string OnMessage(message QueueMessage) }
type RedirectAttribute ¶
func (*RedirectAttribute) Initialize ¶
func (a *RedirectAttribute) Initialize(page *l.Page)
func (*RedirectAttribute) InitializeSSR ¶
func (a *RedirectAttribute) InitializeSSR(page *l.Page)
type ScrollTopAttribute ¶
func (*ScrollTopAttribute) Initialize ¶
func (a *ScrollTopAttribute) Initialize(page *l.Page)
func (*ScrollTopAttribute) InitializeSSR ¶
func (a *ScrollTopAttribute) InitializeSSR(page *l.Page)
type SubscribeFunc ¶
type SubscribeFunc struct {
// contains filtered or unexported fields
}
func NewSub ¶
func NewSub(onMessageFn func(message QueueMessage)) SubscribeFunc
func (SubscribeFunc) GetID ¶
func (s SubscribeFunc) GetID() string
func (SubscribeFunc) OnMessage ¶
func (s SubscribeFunc) OnMessage(message QueueMessage)