Documentation
¶
Index ¶
- func DefineComponent[P any](client *Client, name string, renderFn func(ctx context.Context, props P) any) vdom.Component[P]
- func ServeFileOption(w http.ResponseWriter, r *http.Request, option FileHandlerOption) error
- type AppOpts
- type Client
- func (client *Client) AddSetupFn(fn func())
- func (client *Client) Connect() error
- func (c *Client) CreateVDomContext(target *vdom.VDomTarget) error
- func (c *Client) GetAtomVal(name string) any
- func (c *Client) GetIsDone() bool
- func (c *Client) RegisterComponent(name string, cfunc any) error
- func (client *Client) RegisterDefaultFlags()
- func (c *Client) RegisterFileHandler(path string, option FileHandlerOption)
- func (c *Client) RegisterFilePrefixHandler(prefix string, optionProvider func(path string) (*FileHandlerOption, error))
- func (c *Client) RegisterUrlPathHandler(path string, handler http.Handler)
- func (client *Client) RunMain()
- func (c *Client) SendAsyncInitiation() error
- func (c *Client) SetAtomVal(name string, val any)
- func (c *Client) SetAtomVals(m map[string]any)
- func (c *Client) SetGlobalEventHandler(handler func(client *Client, event vdom.VDomEvent))
- func (c *Client) SetOverrideUrlHandler(handler http.Handler)
- func (c *Client) SetRootElem(elem *vdom.VDomElem)
- type FileHandlerOption
- type StreamingResponseWriter
- type WaveAppServerImpl
- func (impl *WaveAppServerImpl) VDomRenderCommand(ctx context.Context, feUpdate vdom.VDomFrontendUpdate) chan wshrpc.RespOrErrorUnion[*vdom.VDomBackendUpdate]
- func (impl *WaveAppServerImpl) VDomUrlRequestCommand(ctx context.Context, data wshrpc.VDomUrlRequestData) chan wshrpc.RespOrErrorUnion[wshrpc.VDomUrlRequestResponse]
- func (*WaveAppServerImpl) WshServerImpl()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefineComponent ¶
func ServeFileOption ¶
func ServeFileOption(w http.ResponseWriter, r *http.Request, option FileHandlerOption) error
ServeFileOption handles serving content based on the provided FileHandlerOption
Types ¶
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 (*Client) AddSetupFn ¶
func (client *Client) AddSetupFn(fn func())
func (*Client) CreateVDomContext ¶
func (c *Client) CreateVDomContext(target *vdom.VDomTarget) error
func (*Client) GetAtomVal ¶
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 (*Client) SendAsyncInitiation ¶
func (*Client) SetAtomVal ¶
func (*Client) SetAtomVals ¶
func (*Client) SetGlobalEventHandler ¶
func (*Client) SetOverrideUrlHandler ¶
func (*Client) SetRootElem ¶
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 NewStreamingResponseWriter ¶
func NewStreamingResponseWriter(respChan chan<- wshrpc.RespOrErrorUnion[wshrpc.VDomUrlRequestResponse]) *StreamingResponseWriter
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 ¶
func (*WaveAppServerImpl) VDomRenderCommand ¶
func (impl *WaveAppServerImpl) VDomRenderCommand(ctx context.Context, feUpdate vdom.VDomFrontendUpdate) chan wshrpc.RespOrErrorUnion[*vdom.VDomBackendUpdate]
func (*WaveAppServerImpl) VDomUrlRequestCommand ¶
func (impl *WaveAppServerImpl) VDomUrlRequestCommand(ctx context.Context, data wshrpc.VDomUrlRequestData) chan wshrpc.RespOrErrorUnion[wshrpc.VDomUrlRequestResponse]
func (*WaveAppServerImpl) WshServerImpl ¶
func (*WaveAppServerImpl) WshServerImpl()
Click to show internal directories.
Click to hide internal directories.