waveapp

package
v0.10.2 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2024 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefineComponent

func DefineComponent[P any](client *Client, name string, renderFn func(ctx context.Context, props P) any) vdom.Component[P]

func ServeFileOption

func ServeFileOption(w http.ResponseWriter, r *http.Request, option FileHandlerOption) error

ServeFileOption handles serving content based on the provided FileHandlerOption

Types

type AppOpts

type AppOpts struct {
	CloseOnCtrlC         bool
	GlobalKeyboardEvents bool
	GlobalStyles         []byte
	RootComponentName    string // defaults to "App"
	NewBlockFlag         string // defaults to "n" (set to "-" to disable)
	TargetNewBlock       bool
	TargetToolbar        *vdom.VDomTargetToolbar
}

type Client

type Client struct {
	Lock               *sync.Mutex
	AppOpts            AppOpts
	Root               *vdom.RootElem
	RootElem           *vdom.VDomElem
	RpcClient          *wshutil.WshRpc
	RpcContext         *wshrpc.RpcContext
	ServerImpl         *WaveAppServerImpl
	IsDone             bool
	RouteId            string
	VDomContextBlockId string
	DoneReason         string
	DoneCh             chan struct{}
	Opts               vdom.VDomBackendOpts
	GlobalEventHandler func(client *Client, event vdom.VDomEvent)
	GlobalStylesOption *FileHandlerOption
	UrlHandlerMux      *mux.Router
	OverrideUrlHandler http.Handler
	NewBlockFlag       bool
	SetupFn            func()
}

func MakeClient

func MakeClient(appOpts AppOpts) *Client

func (*Client) AddSetupFn

func (client *Client) AddSetupFn(fn func())

func (*Client) Connect

func (client *Client) Connect() error

func (*Client) CreateVDomContext

func (c *Client) CreateVDomContext(target *vdom.VDomTarget) error

func (*Client) GetAtomVal

func (c *Client) GetAtomVal(name string) any

func (*Client) GetIsDone

func (c *Client) GetIsDone() bool

func (*Client) RegisterComponent

func (c *Client) RegisterComponent(name string, cfunc any) error

func (*Client) RegisterDefaultFlags

func (client *Client) RegisterDefaultFlags()

func (*Client) RegisterFileHandler

func (c *Client) RegisterFileHandler(path string, option FileHandlerOption)

func (*Client) RegisterFilePrefixHandler

func (c *Client) RegisterFilePrefixHandler(prefix string, optionProvider func(path string) (*FileHandlerOption, error))

func (*Client) RegisterUrlPathHandler

func (c *Client) RegisterUrlPathHandler(path string, handler http.Handler)

func (*Client) RunMain

func (client *Client) RunMain()

func (*Client) SendAsyncInitiation

func (c *Client) SendAsyncInitiation() error

func (*Client) SetAtomVal

func (c *Client) SetAtomVal(name string, val any)

func (*Client) SetAtomVals

func (c *Client) SetAtomVals(m map[string]any)

func (*Client) SetGlobalEventHandler

func (c *Client) SetGlobalEventHandler(handler func(client *Client, event vdom.VDomEvent))

func (*Client) SetOverrideUrlHandler

func (c *Client) SetOverrideUrlHandler(handler http.Handler)

func (*Client) SetRootElem

func (c *Client) SetRootElem(elem *vdom.VDomElem)

type FileHandlerOption

type FileHandlerOption struct {
	FilePath string    // optional file path on disk
	Data     []byte    // optional byte slice content
	Reader   io.Reader // optional reader for content
	File     fs.File   // optional embedded or opened file
	MimeType string    // optional mime type
	ETag     string    // optional ETag (if set, resource may be cached)
}

type StreamingResponseWriter

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

StreamingResponseWriter implements http.ResponseWriter interface to stream response data through a channel rather than buffering it in memory. This is particularly useful for handling large responses like video streams or file downloads.

func (*StreamingResponseWriter) Close

func (w *StreamingResponseWriter) Close() error

func (*StreamingResponseWriter) Header

func (w *StreamingResponseWriter) Header() http.Header

func (*StreamingResponseWriter) Write

func (w *StreamingResponseWriter) Write(data []byte) (int, error)

func (*StreamingResponseWriter) WriteHeader

func (w *StreamingResponseWriter) WriteHeader(statusCode int)

type WaveAppServerImpl

type WaveAppServerImpl struct {
	Client  *Client
	BlockId string
}

func (*WaveAppServerImpl) VDomRenderCommand

func (*WaveAppServerImpl) VDomUrlRequestCommand

func (*WaveAppServerImpl) WshServerImpl

func (*WaveAppServerImpl) WshServerImpl()

Jump to

Keyboard shortcuts

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