Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HandlerFunc ¶
type HandlerFunc func(params json.RawMessage) (any, error)
HandlerFunc processes an IPC request and returns a result or error.
type Request ¶
type Request struct {
ID string `json:"id"`
Method string `json:"method"`
Params json.RawMessage `json:"params"`
}
Request is a message from JS to Go.
type Response ¶
type Response struct {
ID string `json:"id"`
Result any `json:"result"`
Error string `json:"error,omitempty"`
}
Response is a message from Go to JS.
type Router ¶
type Router struct {
// contains filtered or unexported fields
}
Router routes IPC method calls to handler functions.
func SetupRouter ¶
func SetupRouter() *Router
SetupRouter creates and returns a router with no handlers registered. API handlers are registered by calling router.Handle() from each api package.
func (*Router) Handle ¶
func (r *Router) Handle(method string, handler HandlerFunc)
Handle registers a handler for a method name.
func (*Router) HandleMessage ¶
HandleMessage processes a raw JSON message from the webview and returns the JSON response.
func (*Router) SetEvalFunc ¶
SetEvalFunc sets the function used to send JS to the webview.
Click to show internal directories.
Click to hide internal directories.