web

package
v0.0.0-...-91adec5 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Application

type Application struct {
	WebsocketRoutePath string
	// contains filtered or unexported fields
}

func NewApplication

func NewApplication(wsRoutePath string) *Application

func (*Application) CallJS

func (a *Application) CallJS(eval string, callback func(any))

func (*Application) NewWindow

func (a *Application) NewWindow() *Window

func (*Application) WebsocketHandler

func (a *Application) WebsocketHandler(w http.ResponseWriter, r *http.Request)

func (*Application) WsScriptHandler

func (a *Application) WsScriptHandler(w http.ResponseWriter, r *http.Request)

type Bridge

type Bridge interface {
	Call(funcname string, args ...string) Promise[any]
}

type Container

type Container[T IElement] struct {
	*Element[T]
	Children []IElement
}

func (*Container[T]) Body

func (e *Container[T]) Body(children ...IElement) T

func (*Container[T]) Marshal

func (e *Container[T]) Marshal() string

func (*Container[T]) MarshalIndent

func (e *Container[T]) MarshalIndent(prefix string) string

type ContainerButton

type ContainerButton struct {
	*Container[*ContainerButton]
}

func Button

func Button(texts ...string) *ContainerButton

type ContainerDiv

type ContainerDiv struct {
	*Container[*ContainerDiv]
}

func Div

func Div(children ...IElement) *ContainerDiv

func DivAttr

func DivAttr() *ContainerDiv

type ContainerHTML

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

func HTML

func HTML() *ContainerHTML

func (*ContainerHTML) Body

func (c *ContainerHTML) Body(children ...IElement) *ContainerHTML

func (*ContainerHTML) Head

func (c *ContainerHTML) Head(children ...IElement) *ContainerHTML

func (*ContainerHTML) Marshal

func (e *ContainerHTML) Marshal() string

func (*ContainerHTML) MarshalIndent

func (e *ContainerHTML) MarshalIndent(prefix string) string

type ContainerScript

type ContainerScript struct {
	*Container[*ContainerScript]
}

func Script

func Script(jsCode string) *ContainerScript

func ScriptSrc

func ScriptSrc(src string) *ContainerScript

type ContainerSpan

type ContainerSpan struct {
	*Container[*ContainerSpan]
}

func Span

func Span(texts ...string) *ContainerSpan

type ContainerTitle

type ContainerTitle struct {
	*Element[*NodeText]
	Text string
}

type Element

type Element[T IElement] struct {
	TagName string
	// contains filtered or unexported fields
}

func (*Element[T]) GetAttribute

func (e *Element[T]) GetAttribute(key string) string

func (*Element[T]) ID

func (e *Element[T]) ID(id string) T

func (*Element[T]) Marshal

func (e *Element[T]) Marshal() string

func (*Element[T]) MarshalIndent

func (e *Element[T]) MarshalIndent(prefix string) string

func (*Element[T]) OnClick

func (e *Element[T]) OnClick(a *Application, fn func()) T

func (*Element[T]) SetAttribute

func (e *Element[T]) SetAttribute(key string, value string) T

type IElement

type IElement interface {
	Marshal() string
	MarshalIndent(prefix string) string
}

type NodeText

type NodeText struct {
	Text string
}

func Text

func Text(text string) *NodeText

func (*NodeText) Marshal

func (e *NodeText) Marshal() string

func (*NodeText) MarshalIndent

func (e *NodeText) MarshalIndent(prefix string) string

type Promise

type Promise[T any] struct {
	ID   uint64
	Data T
}

type Window

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

func (*Window) Body

func (w *Window) Body(elements ...IElement) *Window

func (*Window) Export

func (w *Window) Export() string

Jump to

Keyboard shortcuts

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