door

package
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 20, 2025 License: UNKNOWN not legal advice Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttrHook

type AttrHook struct {
	Trigger func(ctx context.Context, w http.ResponseWriter, r *http.Request) Done
	Cancel  func(ctx context.Context, err error)
}

type Cinema

type Cinema struct {
	// contains filtered or unexported fields
}

func (*Cinema) AddWatcher

func (ss *Cinema) AddWatcher(ctx context.Context, screenId uint64, w Watcher, lastSeq uint) bool

func (*Cinema) InitSync

func (ss *Cinema) InitSync(syncThread *shredder.Thread, ctx context.Context, id uint64, seq uint, c *common.FuncCollector)

type ClientCall

type ClientCall struct {
	Name    string
	Arg     any
	Trigger func(ctx context.Context, w http.ResponseWriter, r *http.Request)
	Cancel  func(ctx context.Context, err error)
}

type Core

type Core interface {
	Id() uint64
	Cinema() *Cinema
	RegisterAttrHook(ctx context.Context, h *AttrHook) (*HookEntry, bool)
	RegisterClientCall(ctx context.Context, call *ClientCall) (func(), bool)
}

type Done

type Done = bool

type Door

type Door struct {
	Tag string
	A   templ.Attributes
	// contains filtered or unexported fields
}

func (*Door) Clear

func (n *Door) Clear(ctx context.Context)

Clear removes all content from the door, equivalent to Update(ctx, nil). The door's DOM element remains but its children are removed. This is useful for emptying a container while keeping it available for future content.

func (*Door) Reload

func (n *Door) Reload(ctx context.Context)

Reload re-renders the door with its current content. This is useful when you want to refresh a door without changing its content, for example to reflect external state changes. If the door is not currently active, the operation completes immediately without visual effect.

func (*Door) Remove

func (n *Door) Remove(ctx context.Context)

Remove removes the door and its DOM element from the page. If the door is not currently active, it is marked as removed and will not render if attempted to be rendered.

func (*Door) Render

func (n *Door) Render(ctx context.Context, w io.Writer) error

func (*Door) Replace

func (n *Door) Replace(ctx context.Context, content templ.Component)

Replace replaces the entire door element with new content. Unlike Update, this removes the door's DOM element entirely and replaces it with the rendered content. If the door is not currently active, the content change is stored and will be applied when the door is rendered.

func (*Door) Update

func (n *Door) Update(ctx context.Context, content templ.Component)

Update changes the content of the door and re-renders it in place. The door's children are replaced with the new content while preserving the door's DOM element. If the door is not currently active, the content change is stored and will be applied when the door is rendered.

func (*Door) XClear

func (n *Door) XClear(ctx context.Context) <-chan error

XClear returns a channel that can be used to track when the clear operation completes. The channel will receive nil on success or an error if the operation fails. The channel is closed after sending the result. If the door is not active, the channel is closed immediately without sending any value. This is equivalent to XUpdate(ctx, nil) and empties the door's content.

func (*Door) XReload

func (n *Door) XReload(ctx context.Context) <-chan error

XReload returns a channel that can be used to track when the reload operation completes. The channel will receive nil on success or an error if the operation fails. The channel is closed after sending the result. If the door is not active, the channel is closed immediately without sending any value. A blocking context warning is logged if called from a blocking context.

func (*Door) XRemove

func (n *Door) XRemove(ctx context.Context) <-chan error

XRemove returns a channel that can be used to track when the remove operation completes. The channel will receive nil on success or an error if the operation fails. The channel is closed after sending the result. If the door is not active, the channel is closed immediately without sending any value. A blocking context warning is logged if called from a blocking context.

func (*Door) XReplace

func (n *Door) XReplace(ctx context.Context, content templ.Component) <-chan error

XReplace returns a channel that can be used to track when the replace operation completes. The channel will receive nil on success or an error if the operation fails. The channel is closed after sending the result. If the door is not active, the channel is closed immediately without sending any value. A blocking context warning is logged if called from a blocking context.

func (*Door) XUpdate

func (n *Door) XUpdate(ctx context.Context, content templ.Component) <-chan error

XUpdate returns a channel that can be used to track when the update operation completes. The channel will receive nil on success or an error if the operation fails. The channel is closed after sending the result. If the door is not active, the channel is closed immediately without sending any value. A blocking context warning is logged if called from a blocking context.

type DoorHook

type DoorHook struct {
	// contains filtered or unexported fields
}

func (*DoorHook) Cancel

func (h *DoorHook) Cancel(err error)

func (*DoorHook) Trigger

func (h *DoorHook) Trigger(w http.ResponseWriter, r *http.Request) (Done, bool)

type Hook

type Hook interface {
	// contains filtered or unexported methods
}

type HookEntry

type HookEntry struct {
	DoorId uint64
	HookId uint64
	// contains filtered or unexported fields
}

func (HookEntry) Cancel

func (h HookEntry) Cancel()

type Root

type Root struct {
	// contains filtered or unexported fields
}

func NewRoot

func NewRoot(ctx context.Context, inst instance) *Root

func (*Root) Cinema

func (r *Root) Cinema() *Cinema

func (*Root) Ctx

func (r *Root) Ctx() context.Context

func (*Root) Kill

func (r *Root) Kill()

func (*Root) Render

func (r *Root) Render(content templ.Component) <-chan *RootRender

type RootRender

type RootRender struct {
	// contains filtered or unexported fields
}

func (*RootRender) Err

func (r *RootRender) Err() error

func (*RootRender) Write

func (r *RootRender) Write(w io.Writer) error

type Screen

type Screen struct {
	// contains filtered or unexported fields
}

func (*Screen) UnregWatcher

func (s *Screen) UnregWatcher(id uint)

type Watcher

type Watcher interface {
	GetId() uint
	Sync(context.Context, uint, *common.FuncCollector)
	Cancel()
	Init(context.Context, *Screen, uint, uint) func()
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL