client

package
v1.9.3 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action added in v1.9.3

type Action struct {
	ID              bool     `json:"id,omitempty"`
	Name            bool     `json:"name,omitempty"`
	NodeType        bool     `json:"node_type,omitempty"`
	Class           bool     `json:"class,omitempty"`
	Attributes      []string `json:"attributes,omitempty"`
	AttributeValues bool     `json:"attribute_values,omitempty"`
	InnerText       bool     `json:"inner_text,omitempty"`
	InnerHTML       bool     `json:"inner_html,omitempty"`
	OuterHTML       bool     `json:"outer_html,omitempty"`
	TextContent     bool     `json:"text_content,omitempty"`
	// For <canvas> elements.
	GraphicsContext string `json:"graphics_context,omitempty"`
	PixelData       bool   `json:"pixel_data,omitempty"`
}

Action describes which Element fields should be populated for matched Elements.

type Client

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

func NewClient

func NewClient(backendAddr string) *Client

func (*Client) CreateResource

func (c *Client) CreateResource(r *api.Resource) error

type Element added in v1.9.3

type Element struct {
	ID          string            `json:"id,omitempty"`
	Name        string            `json:"name,omitempty"`
	NodeType    string            `json:"node_type,omitempty"`
	Class       string            `json:"class,omitempty"`
	Attributes  map[string]string `json:"attributes,omitempty"`
	InnerText   string            `json:"inner_text,omitempty"`
	InnerHTML   string            `json:"inner_html,omitempty"`
	OuterHTML   string            `json:"outer_html,omitempty"`
	TextContent string            `json:"text_content,omitempty"`
	// For <canvas> elements.
	GraphicsContext string  `json:"graphics_context,omitempty"`
	PixelData       []uint8 `json:"pixel_data,omitempty"`
}

Element contains a serializable version of the observable parts of a JS element.

Not all fields need be set for a given instance.

type Envelope added in v1.9.3

type Envelope struct {
	Type string `json:"type,omitempty"`
	Data any    `json:",omitempty"`
}

Envelope wraps all messages between the browser and the service worker.

We do this to mux messages by a type name.

type Filter added in v1.9.3

type Filter struct {
	ID             string `json:"id,omitempty"`
	Name           string `json:"name,omitempty"`
	NodeType       string `json:"node_type,omitempty"`
	Class          string `json:"class,omitempty"`
	Attribute      string `json:"attribute,omitempty"`
	AttributeValue string `json:"attribute_value,omitempty"`
	AttributeEmpty bool   `json:"attribute_empty,omitempty"`
	Selector       string `json:"selector,omitempty"`
}

Filter contains a CSS selector which matches Elements on the page.

Filter is sent as part of the Rule message.

type Navigate struct {
	URL string `json:"url,omitempty"`
}

Navigate contains the page's URL.

Navigate is sent from the browser to the service worker when the page's URL has changes.

type Observe added in v1.9.3

type Observe struct {
	Rules []Rule `json:"filter_list,omitempty"`
}

Observe contains a list of rules to observe.

Observe is sent from the service worker to the browser with a list of rules to observe.

type Results added in v1.9.3

type Results struct {
	Elements []Element
}

Results contains the processed elements as the result of observing DOM changes with the given filters.

type Rule added in v1.9.3

type Rule struct {
	Filter Filter `json:"filter,omitempty"`
	Action Action `json:"action,omitempty"`
}

Rule contains a filter and a list of Actions.

Rule is sent as part of the Observe message.

Jump to

Keyboard shortcuts

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