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 VDomServerImpl
- func (impl *VDomServerImpl) VDomRenderCommand(ctx context.Context, feUpdate vdom.VDomFrontendUpdate) chan wshrpc.RespOrErrorUnion[*vdom.VDomBackendUpdate]
- func (impl *VDomServerImpl) VDomUrlRequestCommand(ctx context.Context, data wshrpc.VDomUrlRequestData) chan wshrpc.RespOrErrorUnion[wshrpc.VDomUrlRequestResponse]
- func (*VDomServerImpl) WshServerImpl()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefineComponent ¶ added in v0.9.2
func ServeFileOption ¶ added in v0.9.2
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 *VDomServerImpl 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 ¶ added in v0.9.2
func (client *Client) AddSetupFn(fn func())
func (*Client) CreateVDomContext ¶
func (c *Client) CreateVDomContext(target *vdom.VDomTarget) error
func (*Client) GetAtomVal ¶
func (*Client) RegisterDefaultFlags ¶ added in v0.9.2
func (client *Client) RegisterDefaultFlags()
func (*Client) RegisterFileHandler ¶ added in v0.9.2
func (c *Client) RegisterFileHandler(path string, option FileHandlerOption)
func (*Client) RegisterFilePrefixHandler ¶ added in v0.9.2
func (c *Client) RegisterFilePrefixHandler(prefix string, optionProvider func(path string) (*FileHandlerOption, error))
func (*Client) RegisterUrlPathHandler ¶ added in v0.9.2
func (*Client) SendAsyncInitiation ¶
func (*Client) SetAtomVal ¶
func (*Client) SetAtomVals ¶
func (*Client) SetGlobalEventHandler ¶
func (*Client) SetOverrideUrlHandler ¶ added in v0.9.2
func (*Client) SetRootElem ¶
type FileHandlerOption ¶ added in v0.9.2
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 ¶ added in v0.9.2
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 ¶ added in v0.9.2
func NewStreamingResponseWriter(respChan chan<- wshrpc.RespOrErrorUnion[wshrpc.VDomUrlRequestResponse]) *StreamingResponseWriter
func (*StreamingResponseWriter) Close ¶ added in v0.9.2
func (w *StreamingResponseWriter) Close() error
func (*StreamingResponseWriter) Header ¶ added in v0.9.2
func (w *StreamingResponseWriter) Header() http.Header
func (*StreamingResponseWriter) Write ¶ added in v0.9.2
func (w *StreamingResponseWriter) Write(data []byte) (int, error)
func (*StreamingResponseWriter) WriteHeader ¶ added in v0.9.2
func (w *StreamingResponseWriter) WriteHeader(statusCode int)
type VDomServerImpl ¶
func (*VDomServerImpl) VDomRenderCommand ¶
func (impl *VDomServerImpl) VDomRenderCommand(ctx context.Context, feUpdate vdom.VDomFrontendUpdate) chan wshrpc.RespOrErrorUnion[*vdom.VDomBackendUpdate]
func (*VDomServerImpl) VDomUrlRequestCommand ¶ added in v0.9.2
func (impl *VDomServerImpl) VDomUrlRequestCommand(ctx context.Context, data wshrpc.VDomUrlRequestData) chan wshrpc.RespOrErrorUnion[wshrpc.VDomUrlRequestResponse]
func (*VDomServerImpl) WshServerImpl ¶
func (*VDomServerImpl) WshServerImpl()
Click to show internal directories.
Click to hide internal directories.