Documentation
¶
Overview ¶
Package control provides a local control channel for a running kitty-browse process.
Index ¶
- func Action(ctx context.Context, endpoint string, request json.RawMessage) (json.RawMessage, error)
- func Capture(ctx context.Context, endpoint string, fullPage bool) ([]byte, error)
- func Info(ctx context.Context, endpoint string) (json.RawMessage, error)
- func Quit(ctx context.Context, endpoint string) error
- type ActionFunc
- type CaptureFunc
- type InfoFunc
- type Option
- type QuitFunc
- type Server
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Action ¶
func Action(ctx context.Context, endpoint string, request json.RawMessage) (json.RawMessage, error)
Action sends an action request through endpoint. A valid JSON response is returned even when its HTTP status indicates an API error, so callers can inspect the API error envelope.
Types ¶
type ActionFunc ¶
type ActionFunc func(context.Context, json.RawMessage) (json.RawMessage, error)
ActionFunc executes a JSON action request and returns its JSON response.
type CaptureFunc ¶
CaptureFunc captures a PNG. fullPage is false for the current viewport and true for the complete page.
type InfoFunc ¶
type InfoFunc func(context.Context) (json.RawMessage, error)
InfoFunc returns the current browser information as JSON.
type Option ¶
type Option func(*serverConfig)
Option configures optional control server functionality.
func WithAPI ¶
func WithAPI(info InfoFunc, action ActionFunc) Option
WithAPI enables the information and action API. A nil callback leaves its corresponding route disabled.
type QuitFunc ¶ added in v0.2.2
QuitFunc asks the browser to shut down gracefully. It is called after the quit response has been flushed to the caller, so the answer is never lost to the teardown it triggers.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is a screenshot control server.