web_view

package
v0.56.1 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const SRPCAccessWebViewsServiceID = "web.view.AccessWebViews"
View Source
const SRPCWebViewHostServiceID = "web.view.WebViewHost"
View Source
const SRPCWebViewServiceID = "web.view.WebView"

Variables

View Source
var (
	// ErrEmptyWebViewID is returned if the web view id was empty.
	ErrEmptyWebViewID = errors.New("empty web view id")
	// ErrWebViewPermanent is returned if WebView cannot be closed.
	ErrWebViewPermanent = errors.New("WebView cannot be closed")
)
View Source
var (
	RenderMode_name = map[int32]string{
		0: "RenderMode_NONE",
		1: "RenderMode_REACT_COMPONENT",
		2: "RenderMode_FUNCTION",
		3: "RenderMode_REACT_CHILDREN",
	}
	RenderMode_value = map[string]int32{
		"RenderMode_NONE":            0,
		"RenderMode_REACT_COMPONENT": 1,
		"RenderMode_FUNCTION":        2,
		"RenderMode_REACT_CHILDREN":  3,
	}
)

Enum value maps for RenderMode.

Functions

func ExHandleWebView

func ExHandleWebView(
	rctx context.Context,
	le *logrus.Entry,
	b bus.Bus,
	webView WebView,
	returnIfErr bool,
) (err error)

ExHandleWebView executes handling a web view with a bus.

if returnIfErr is set, if any resolvers return an error, returns that error.

func NewSRPCAccessWebViewsHandler

func NewSRPCAccessWebViewsHandler(impl SRPCAccessWebViewsServer, serviceID string) srpc.Handler

NewSRPCAccessWebViewsHandler constructs a new RPC handler. serviceID: if empty, uses default: web.view.AccessWebViews

func NewSRPCWebViewHandler

func NewSRPCWebViewHandler(impl SRPCWebViewServer, serviceID string) srpc.Handler

NewSRPCWebViewHandler constructs a new RPC handler. serviceID: if empty, uses default: web.view.WebView

func NewSRPCWebViewHostHandler

func NewSRPCWebViewHostHandler(impl SRPCWebViewHostServer, serviceID string) srpc.Handler

NewSRPCWebViewHostHandler constructs a new RPC handler. serviceID: if empty, uses default: web.view.WebViewHost

func SRPCRegisterAccessWebViews

func SRPCRegisterAccessWebViews(mux srpc.Mux, impl SRPCAccessWebViewsServer) error

SRPCRegisterAccessWebViews registers the implementation with the mux. Uses the default serviceID: web.view.AccessWebViews

func SRPCRegisterWebView

func SRPCRegisterWebView(mux srpc.Mux, impl SRPCWebViewServer) error

SRPCRegisterWebView registers the implementation with the mux. Uses the default serviceID: web.view.WebView

func SRPCRegisterWebViewHost

func SRPCRegisterWebViewHost(mux srpc.Mux, impl SRPCWebViewHostServer) error

SRPCRegisterWebViewHost registers the implementation with the mux. Uses the default serviceID: web.view.WebViewHost

func WebViewServerID

func WebViewServerID(webViewID string) string

WebViewServerID builds the server id for services called on the WebViewHost mux.

Types

type HandleWebView

type HandleWebView interface {
	// Directive indicates HandleWebView is a directive.
	directive.Directive

	// HandleWebView is the web view to handle.
	// Cannot be empty.
	HandleWebView() WebView
}

HandleWebView is a directive to handle a WebView.

func NewHandleWebView

func NewHandleWebView(webView WebView) HandleWebView

NewHandleWebView constructs a new HandleWebView directive.

type HtmlLink struct {

	// Href is the URL to load.
	Href string `protobuf:"bytes,1,opt,name=href,proto3" json:"href,omitempty"`
	// Rel is the type of link this is.
	// Usually "stylesheet"
	Rel string `protobuf:"bytes,2,opt,name=rel,proto3" json:"rel,omitempty"`
	// contains filtered or unexported fields
}

HtmlLink is a html link element for loading css & other resources.

func (*HtmlLink) CloneMessageVT

func (m *HtmlLink) CloneMessageVT() protobuf_go_lite.CloneMessage

func (*HtmlLink) CloneVT

func (m *HtmlLink) CloneVT() *HtmlLink

func (*HtmlLink) EqualMessageVT

func (this *HtmlLink) EqualMessageVT(thatMsg any) bool

func (*HtmlLink) EqualVT

func (this *HtmlLink) EqualVT(that *HtmlLink) bool

func (*HtmlLink) GetHref

func (x *HtmlLink) GetHref() string

func (*HtmlLink) GetRel

func (x *HtmlLink) GetRel() string

func (*HtmlLink) MarshalJSON

func (x *HtmlLink) MarshalJSON() ([]byte, error)

MarshalJSON marshals the HtmlLink to JSON.

func (*HtmlLink) MarshalProtoJSON

func (x *HtmlLink) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the HtmlLink message to JSON.

func (*HtmlLink) MarshalProtoText

func (x *HtmlLink) MarshalProtoText() string

func (*HtmlLink) MarshalToSizedBufferVT

func (m *HtmlLink) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*HtmlLink) MarshalToVT

func (m *HtmlLink) MarshalToVT(dAtA []byte) (int, error)

func (*HtmlLink) MarshalVT

func (m *HtmlLink) MarshalVT() (dAtA []byte, err error)

func (*HtmlLink) ProtoMessage

func (*HtmlLink) ProtoMessage()

func (*HtmlLink) Reset

func (x *HtmlLink) Reset()

func (*HtmlLink) SizeVT

func (m *HtmlLink) SizeVT() (n int)

func (*HtmlLink) String

func (x *HtmlLink) String() string

func (*HtmlLink) UnmarshalJSON

func (x *HtmlLink) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the HtmlLink from JSON.

func (*HtmlLink) UnmarshalProtoJSON

func (x *HtmlLink) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the HtmlLink message from JSON.

func (*HtmlLink) UnmarshalVT

func (m *HtmlLink) UnmarshalVT(dAtA []byte) error

type LookupWebView

type LookupWebView interface {
	// Directive indicates LookupWebView is a directive.
	directive.Directive

	// LookupWebViewID is the web view ID to lookup.
	// Cannot be empty.
	LookupWebViewID() string
	// LookupWebViewWait indicates we should wait for the view to exist.
	//
	// If unset, we expect the view already exists, and will not be recreated
	// after it is deleted (thus pointless to wait if not found).
	LookupWebViewWait() bool
}

LookupWebView is a directive to lookup a WebView.

func NewLookupWebView

func NewLookupWebView(webViewID string, wait bool) LookupWebView

NewLookupWebView constructs a new LookupWebView directive.

type LookupWebViewValue

type LookupWebViewValue = WebView

LookupWebViewValue is the result of LookupWebView.

func ExLookupWebView

func ExLookupWebView(
	ctx context.Context,
	b bus.Bus,
	returnIfIdle bool,
	webViewID string,
	wait bool,
	valDisposeCallback func(),
) (LookupWebViewValue, directive.Instance, directive.Reference, error)

ExLookupWebView looks up a web view by id.

wait waits for the web view to exist.

type RemoveWebViewRequest

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

RemoveWebViewRequest is a request to remove the web view.

func (*RemoveWebViewRequest) CloneMessageVT

func (*RemoveWebViewRequest) CloneVT

func (*RemoveWebViewRequest) EqualMessageVT

func (this *RemoveWebViewRequest) EqualMessageVT(thatMsg any) bool

func (*RemoveWebViewRequest) EqualVT

func (this *RemoveWebViewRequest) EqualVT(that *RemoveWebViewRequest) bool

func (*RemoveWebViewRequest) MarshalJSON

func (x *RemoveWebViewRequest) MarshalJSON() ([]byte, error)

MarshalJSON marshals the RemoveWebViewRequest to JSON.

func (*RemoveWebViewRequest) MarshalProtoJSON

func (x *RemoveWebViewRequest) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the RemoveWebViewRequest message to JSON.

func (*RemoveWebViewRequest) MarshalProtoText

func (x *RemoveWebViewRequest) MarshalProtoText() string

func (*RemoveWebViewRequest) MarshalToSizedBufferVT

func (m *RemoveWebViewRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*RemoveWebViewRequest) MarshalToVT

func (m *RemoveWebViewRequest) MarshalToVT(dAtA []byte) (int, error)

func (*RemoveWebViewRequest) MarshalVT

func (m *RemoveWebViewRequest) MarshalVT() (dAtA []byte, err error)

func (*RemoveWebViewRequest) ProtoMessage

func (*RemoveWebViewRequest) ProtoMessage()

func (*RemoveWebViewRequest) Reset

func (x *RemoveWebViewRequest) Reset()

func (*RemoveWebViewRequest) SizeVT

func (m *RemoveWebViewRequest) SizeVT() (n int)

func (*RemoveWebViewRequest) String

func (x *RemoveWebViewRequest) String() string

func (*RemoveWebViewRequest) UnmarshalJSON

func (x *RemoveWebViewRequest) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the RemoveWebViewRequest from JSON.

func (*RemoveWebViewRequest) UnmarshalProtoJSON

func (x *RemoveWebViewRequest) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the RemoveWebViewRequest message from JSON.

func (*RemoveWebViewRequest) UnmarshalVT

func (m *RemoveWebViewRequest) UnmarshalVT(dAtA []byte) error

type RemoveWebViewResponse

type RemoveWebViewResponse struct {

	// Removed indicates the web view was removed.
	Removed bool `protobuf:"varint,1,opt,name=removed,proto3" json:"removed,omitempty"`
	// contains filtered or unexported fields
}

RemoveWebViewResponse is the response to the RemoveWebView request.

func (*RemoveWebViewResponse) CloneMessageVT

func (*RemoveWebViewResponse) CloneVT

func (*RemoveWebViewResponse) EqualMessageVT

func (this *RemoveWebViewResponse) EqualMessageVT(thatMsg any) bool

func (*RemoveWebViewResponse) EqualVT

func (this *RemoveWebViewResponse) EqualVT(that *RemoveWebViewResponse) bool

func (*RemoveWebViewResponse) GetRemoved

func (x *RemoveWebViewResponse) GetRemoved() bool

func (*RemoveWebViewResponse) MarshalJSON

func (x *RemoveWebViewResponse) MarshalJSON() ([]byte, error)

MarshalJSON marshals the RemoveWebViewResponse to JSON.

func (*RemoveWebViewResponse) MarshalProtoJSON

func (x *RemoveWebViewResponse) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the RemoveWebViewResponse message to JSON.

func (*RemoveWebViewResponse) MarshalProtoText

func (x *RemoveWebViewResponse) MarshalProtoText() string

func (*RemoveWebViewResponse) MarshalToSizedBufferVT

func (m *RemoveWebViewResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*RemoveWebViewResponse) MarshalToVT

func (m *RemoveWebViewResponse) MarshalToVT(dAtA []byte) (int, error)

func (*RemoveWebViewResponse) MarshalVT

func (m *RemoveWebViewResponse) MarshalVT() (dAtA []byte, err error)

func (*RemoveWebViewResponse) ProtoMessage

func (*RemoveWebViewResponse) ProtoMessage()

func (*RemoveWebViewResponse) Reset

func (x *RemoveWebViewResponse) Reset()

func (*RemoveWebViewResponse) SizeVT

func (m *RemoveWebViewResponse) SizeVT() (n int)

func (*RemoveWebViewResponse) String

func (x *RemoveWebViewResponse) String() string

func (*RemoveWebViewResponse) UnmarshalJSON

func (x *RemoveWebViewResponse) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the RemoveWebViewResponse from JSON.

func (*RemoveWebViewResponse) UnmarshalProtoJSON

func (x *RemoveWebViewResponse) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the RemoveWebViewResponse message from JSON.

func (*RemoveWebViewResponse) UnmarshalVT

func (m *RemoveWebViewResponse) UnmarshalVT(dAtA []byte) error

type RenderMode

type RenderMode int32

RenderMode is the list of available WebView rendering modes.

const (
	// RenderMode_NONE selects no renderer (no contents).
	// When setting this mode, everything is "reset" in the view.
	RenderMode_RenderMode_NONE RenderMode = 0
	// RenderMode_REACT_COMPONENT renders a React component from a JS module.
	// Renders the default export of the JS module.
	RenderMode_RenderMode_REACT_COMPONENT RenderMode = 1
	// RenderMode_FUNCTION renders an init function with the following type:
	// (parent: HTMLDivElement) => (() => void)
	// Callback returns a function to call to shutdown the script.
	// Renders the default export of the JS module.
	RenderMode_RenderMode_FUNCTION RenderMode = 2
	// RenderMode_REACT_CHILDREN renders React children passed to the WebView component.
	// This is the default mode when children are passed to the React WebView.
	//
	// Allows tests and local components to render within a WebView context
	// without Go explicitly setting the render mode.
	RenderMode_RenderMode_REACT_CHILDREN RenderMode = 3
)

func (RenderMode) Enum

func (x RenderMode) Enum() *RenderMode

func (RenderMode) MarshalJSON

func (x RenderMode) MarshalJSON() ([]byte, error)

MarshalJSON marshals the RenderMode to JSON.

func (RenderMode) MarshalProtoJSON

func (x RenderMode) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the RenderMode to JSON.

func (RenderMode) MarshalProtoText

func (x RenderMode) MarshalProtoText() string

func (RenderMode) MarshalText

func (x RenderMode) MarshalText() ([]byte, error)

MarshalText marshals the RenderMode to text.

func (RenderMode) String

func (x RenderMode) String() string

func (*RenderMode) UnmarshalJSON

func (x *RenderMode) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the RenderMode from JSON.

func (*RenderMode) UnmarshalProtoJSON

func (x *RenderMode) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the RenderMode from JSON.

func (*RenderMode) UnmarshalText

func (x *RenderMode) UnmarshalText(b []byte) error

UnmarshalText unmarshals the RenderMode from text.

type ResetWebViewRequest

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

ResetWebViewRequest is a request to reset the web view.

func (*ResetWebViewRequest) CloneMessageVT

func (*ResetWebViewRequest) CloneVT

func (*ResetWebViewRequest) EqualMessageVT

func (this *ResetWebViewRequest) EqualMessageVT(thatMsg any) bool

func (*ResetWebViewRequest) EqualVT

func (this *ResetWebViewRequest) EqualVT(that *ResetWebViewRequest) bool

func (*ResetWebViewRequest) MarshalJSON

func (x *ResetWebViewRequest) MarshalJSON() ([]byte, error)

MarshalJSON marshals the ResetWebViewRequest to JSON.

func (*ResetWebViewRequest) MarshalProtoJSON

func (x *ResetWebViewRequest) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the ResetWebViewRequest message to JSON.

func (*ResetWebViewRequest) MarshalProtoText

func (x *ResetWebViewRequest) MarshalProtoText() string

func (*ResetWebViewRequest) MarshalToSizedBufferVT

func (m *ResetWebViewRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*ResetWebViewRequest) MarshalToVT

func (m *ResetWebViewRequest) MarshalToVT(dAtA []byte) (int, error)

func (*ResetWebViewRequest) MarshalVT

func (m *ResetWebViewRequest) MarshalVT() (dAtA []byte, err error)

func (*ResetWebViewRequest) ProtoMessage

func (*ResetWebViewRequest) ProtoMessage()

func (*ResetWebViewRequest) Reset

func (x *ResetWebViewRequest) Reset()

func (*ResetWebViewRequest) SizeVT

func (m *ResetWebViewRequest) SizeVT() (n int)

func (*ResetWebViewRequest) String

func (x *ResetWebViewRequest) String() string

func (*ResetWebViewRequest) UnmarshalJSON

func (x *ResetWebViewRequest) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the ResetWebViewRequest from JSON.

func (*ResetWebViewRequest) UnmarshalProtoJSON

func (x *ResetWebViewRequest) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the ResetWebViewRequest message from JSON.

func (*ResetWebViewRequest) UnmarshalVT

func (m *ResetWebViewRequest) UnmarshalVT(dAtA []byte) error

type ResetWebViewResponse

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

ResetWebViewResponse is a response to reset the web view.

func (*ResetWebViewResponse) CloneMessageVT

func (*ResetWebViewResponse) CloneVT

func (*ResetWebViewResponse) EqualMessageVT

func (this *ResetWebViewResponse) EqualMessageVT(thatMsg any) bool

func (*ResetWebViewResponse) EqualVT

func (this *ResetWebViewResponse) EqualVT(that *ResetWebViewResponse) bool

func (*ResetWebViewResponse) MarshalJSON

func (x *ResetWebViewResponse) MarshalJSON() ([]byte, error)

MarshalJSON marshals the ResetWebViewResponse to JSON.

func (*ResetWebViewResponse) MarshalProtoJSON

func (x *ResetWebViewResponse) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the ResetWebViewResponse message to JSON.

func (*ResetWebViewResponse) MarshalProtoText

func (x *ResetWebViewResponse) MarshalProtoText() string

func (*ResetWebViewResponse) MarshalToSizedBufferVT

func (m *ResetWebViewResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*ResetWebViewResponse) MarshalToVT

func (m *ResetWebViewResponse) MarshalToVT(dAtA []byte) (int, error)

func (*ResetWebViewResponse) MarshalVT

func (m *ResetWebViewResponse) MarshalVT() (dAtA []byte, err error)

func (*ResetWebViewResponse) ProtoMessage

func (*ResetWebViewResponse) ProtoMessage()

func (*ResetWebViewResponse) Reset

func (x *ResetWebViewResponse) Reset()

func (*ResetWebViewResponse) SizeVT

func (m *ResetWebViewResponse) SizeVT() (n int)

func (*ResetWebViewResponse) String

func (x *ResetWebViewResponse) String() string

func (*ResetWebViewResponse) UnmarshalJSON

func (x *ResetWebViewResponse) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the ResetWebViewResponse from JSON.

func (*ResetWebViewResponse) UnmarshalProtoJSON

func (x *ResetWebViewResponse) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the ResetWebViewResponse message from JSON.

func (*ResetWebViewResponse) UnmarshalVT

func (m *ResetWebViewResponse) UnmarshalVT(dAtA []byte) error

type SRPCAccessWebViewsClient

type SRPCAccessWebViewsClient interface {
	// SRPCClient returns the underlying SRPC client.
	SRPCClient() srpc.Client

	// WebViewRpc accesses the WebView service for a view by ID.
	// Id: web view id
	WebViewRpc(ctx context.Context) (SRPCAccessWebViews_WebViewRpcClient, error)
}

func NewSRPCAccessWebViewsClient

func NewSRPCAccessWebViewsClient(cc srpc.Client) SRPCAccessWebViewsClient

func NewSRPCAccessWebViewsClientWithServiceID

func NewSRPCAccessWebViewsClientWithServiceID(cc srpc.Client, serviceID string) SRPCAccessWebViewsClient

type SRPCAccessWebViewsHandler

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

func (SRPCAccessWebViewsHandler) GetMethodIDs

func (SRPCAccessWebViewsHandler) GetMethodIDs() []string

func (*SRPCAccessWebViewsHandler) GetServiceID

func (d *SRPCAccessWebViewsHandler) GetServiceID() string

func (*SRPCAccessWebViewsHandler) InvokeMethod

func (d *SRPCAccessWebViewsHandler) InvokeMethod(
	serviceID, methodID string,
	strm srpc.Stream,
) (bool, error)

func (SRPCAccessWebViewsHandler) InvokeMethod_WebViewRpc

func (SRPCAccessWebViewsHandler) InvokeMethod_WebViewRpc(impl SRPCAccessWebViewsServer, strm srpc.Stream) error

type SRPCAccessWebViewsServer

type SRPCAccessWebViewsServer interface {
	// WebViewRpc accesses the WebView service for a view by ID.
	// Id: web view id
	WebViewRpc(SRPCAccessWebViews_WebViewRpcStream) error
}

type SRPCAccessWebViews_WebViewRpcClient

type SRPCAccessWebViews_WebViewRpcClient interface {
	srpc.Stream
	Send(*rpcstream.RpcStreamPacket) error
	Recv() (*rpcstream.RpcStreamPacket, error)
	RecvTo(*rpcstream.RpcStreamPacket) error
}

type SRPCAccessWebViews_WebViewRpcStream

type SRPCAccessWebViews_WebViewRpcStream interface {
	srpc.Stream
	Send(*rpcstream.RpcStreamPacket) error
	SendAndClose(*rpcstream.RpcStreamPacket) error
	Recv() (*rpcstream.RpcStreamPacket, error)
	RecvTo(*rpcstream.RpcStreamPacket) error
}

type SRPCWebViewClient

type SRPCWebViewClient interface {
	// SRPCClient returns the underlying SRPC client.
	SRPCClient() srpc.Client

	// SetRenderMode sets the rendering mode of the view.
	SetRenderMode(ctx context.Context, in *SetRenderModeRequest) (*SetRenderModeResponse, error)
	// SetHtmlLinks sets a list of HTML Links (i.e. css bundles) to load.
	SetHtmlLinks(ctx context.Context, in *SetHtmlLinksRequest) (*SetHtmlLinksResponse, error)
	// ResetWebView clears the render mode, links, and contents of a WebView.
	ResetWebView(ctx context.Context, in *ResetWebViewRequest) (*ResetWebViewResponse, error)
	// RemoveWebView requests to remove a WebView from the root level.
	RemoveWebView(ctx context.Context, in *RemoveWebViewRequest) (*RemoveWebViewResponse, error)
}

func NewSRPCWebViewClient

func NewSRPCWebViewClient(cc srpc.Client) SRPCWebViewClient

func NewSRPCWebViewClientWithServiceID

func NewSRPCWebViewClientWithServiceID(cc srpc.Client, serviceID string) SRPCWebViewClient

type SRPCWebViewHandler

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

func (SRPCWebViewHandler) GetMethodIDs

func (SRPCWebViewHandler) GetMethodIDs() []string

func (*SRPCWebViewHandler) GetServiceID

func (d *SRPCWebViewHandler) GetServiceID() string

func (*SRPCWebViewHandler) InvokeMethod

func (d *SRPCWebViewHandler) InvokeMethod(
	serviceID, methodID string,
	strm srpc.Stream,
) (bool, error)

func (SRPCWebViewHandler) InvokeMethod_RemoveWebView

func (SRPCWebViewHandler) InvokeMethod_RemoveWebView(impl SRPCWebViewServer, strm srpc.Stream) error

func (SRPCWebViewHandler) InvokeMethod_ResetWebView

func (SRPCWebViewHandler) InvokeMethod_ResetWebView(impl SRPCWebViewServer, strm srpc.Stream) error
func (SRPCWebViewHandler) InvokeMethod_SetHtmlLinks(impl SRPCWebViewServer, strm srpc.Stream) error

func (SRPCWebViewHandler) InvokeMethod_SetRenderMode

func (SRPCWebViewHandler) InvokeMethod_SetRenderMode(impl SRPCWebViewServer, strm srpc.Stream) error

type SRPCWebViewHostClient

type SRPCWebViewHostClient interface {
	// SRPCClient returns the underlying SRPC client.
	SRPCClient() srpc.Client
}

func NewSRPCWebViewHostClient

func NewSRPCWebViewHostClient(cc srpc.Client) SRPCWebViewHostClient

func NewSRPCWebViewHostClientWithServiceID

func NewSRPCWebViewHostClientWithServiceID(cc srpc.Client, serviceID string) SRPCWebViewHostClient

type SRPCWebViewHostHandler

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

func (SRPCWebViewHostHandler) GetMethodIDs

func (SRPCWebViewHostHandler) GetMethodIDs() []string

func (*SRPCWebViewHostHandler) GetServiceID

func (d *SRPCWebViewHostHandler) GetServiceID() string

func (*SRPCWebViewHostHandler) InvokeMethod

func (d *SRPCWebViewHostHandler) InvokeMethod(
	serviceID, methodID string,
	strm srpc.Stream,
) (bool, error)

type SRPCWebViewHostServer

type SRPCWebViewHostServer interface{}

type SRPCWebViewServer

type SRPCWebViewServer interface {
	// SetRenderMode sets the rendering mode of the view.
	SetRenderMode(context.Context, *SetRenderModeRequest) (*SetRenderModeResponse, error)
	// SetHtmlLinks sets a list of HTML Links (i.e. css bundles) to load.
	SetHtmlLinks(context.Context, *SetHtmlLinksRequest) (*SetHtmlLinksResponse, error)
	// ResetWebView clears the render mode, links, and contents of a WebView.
	ResetWebView(context.Context, *ResetWebViewRequest) (*ResetWebViewResponse, error)
	// RemoveWebView requests to remove a WebView from the root level.
	RemoveWebView(context.Context, *RemoveWebViewRequest) (*RemoveWebViewResponse, error)
}

type SRPCWebView_RemoveWebViewStream

type SRPCWebView_RemoveWebViewStream interface {
	srpc.Stream
}

type SRPCWebView_ResetWebViewStream

type SRPCWebView_ResetWebViewStream interface {
	srpc.Stream
}

type SRPCWebView_SetHtmlLinksStream

type SRPCWebView_SetHtmlLinksStream interface {
	srpc.Stream
}

type SRPCWebView_SetRenderModeStream

type SRPCWebView_SetRenderModeStream interface {
	srpc.Stream
}

type SetHtmlLinksRequest

type SetHtmlLinksRequest struct {

	// Clear clears the list of links before setting html_links.
	Clear bool `protobuf:"varint,1,opt,name=clear,proto3" json:"clear,omitempty"`
	// Remove is the set of HTML link keys to remove.
	Remove []string `protobuf:"bytes,2,rep,name=remove,proto3" json:"remove,omitempty"`
	// SetLinks is the set of HTML links to add.
	SetLinks map[string]*HtmlLink `` /* 172-byte string literal not displayed */
	// contains filtered or unexported fields
}

SetHtmlLinksRequest is the request to set a list of HtmlLink

func (*SetHtmlLinksRequest) CloneMessageVT

func (*SetHtmlLinksRequest) CloneVT

func (*SetHtmlLinksRequest) EqualMessageVT

func (this *SetHtmlLinksRequest) EqualMessageVT(thatMsg any) bool

func (*SetHtmlLinksRequest) EqualVT

func (this *SetHtmlLinksRequest) EqualVT(that *SetHtmlLinksRequest) bool

func (*SetHtmlLinksRequest) GetClear

func (x *SetHtmlLinksRequest) GetClear() bool

func (*SetHtmlLinksRequest) GetRemove

func (x *SetHtmlLinksRequest) GetRemove() []string
func (x *SetHtmlLinksRequest) GetSetLinks() map[string]*HtmlLink

func (*SetHtmlLinksRequest) Logger

func (m *SetHtmlLinksRequest) Logger(le *logrus.Entry) *logrus.Entry

Logger builds the logger for the request.

func (*SetHtmlLinksRequest) MarshalJSON

func (x *SetHtmlLinksRequest) MarshalJSON() ([]byte, error)

MarshalJSON marshals the SetHtmlLinksRequest to JSON.

func (*SetHtmlLinksRequest) MarshalProtoJSON

func (x *SetHtmlLinksRequest) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the SetHtmlLinksRequest message to JSON.

func (*SetHtmlLinksRequest) MarshalProtoText

func (x *SetHtmlLinksRequest) MarshalProtoText() string

func (*SetHtmlLinksRequest) MarshalToSizedBufferVT

func (m *SetHtmlLinksRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*SetHtmlLinksRequest) MarshalToVT

func (m *SetHtmlLinksRequest) MarshalToVT(dAtA []byte) (int, error)

func (*SetHtmlLinksRequest) MarshalVT

func (m *SetHtmlLinksRequest) MarshalVT() (dAtA []byte, err error)

func (*SetHtmlLinksRequest) ProtoMessage

func (*SetHtmlLinksRequest) ProtoMessage()

func (*SetHtmlLinksRequest) Reset

func (x *SetHtmlLinksRequest) Reset()

func (*SetHtmlLinksRequest) SizeVT

func (m *SetHtmlLinksRequest) SizeVT() (n int)

func (*SetHtmlLinksRequest) String

func (x *SetHtmlLinksRequest) String() string

func (*SetHtmlLinksRequest) UnmarshalJSON

func (x *SetHtmlLinksRequest) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the SetHtmlLinksRequest from JSON.

func (*SetHtmlLinksRequest) UnmarshalProtoJSON

func (x *SetHtmlLinksRequest) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the SetHtmlLinksRequest message from JSON.

func (*SetHtmlLinksRequest) UnmarshalVT

func (m *SetHtmlLinksRequest) UnmarshalVT(dAtA []byte) error

func (*SetHtmlLinksRequest) Validate

func (m *SetHtmlLinksRequest) Validate() error

Validate validates the SetHtmlLinksRequest configuration.

type SetHtmlLinksRequest_SetLinksEntry

type SetHtmlLinksRequest_SetLinksEntry struct {
	Key   string    `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Value *HtmlLink `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*SetHtmlLinksRequest_SetLinksEntry) GetKey

func (*SetHtmlLinksRequest_SetLinksEntry) GetValue

func (*SetHtmlLinksRequest_SetLinksEntry) MarshalJSON

func (x *SetHtmlLinksRequest_SetLinksEntry) MarshalJSON() ([]byte, error)

MarshalJSON marshals the SetHtmlLinksRequest_SetLinksEntry to JSON.

func (*SetHtmlLinksRequest_SetLinksEntry) MarshalProtoJSON

func (x *SetHtmlLinksRequest_SetLinksEntry) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the SetHtmlLinksRequest_SetLinksEntry message to JSON.

func (*SetHtmlLinksRequest_SetLinksEntry) MarshalProtoText

func (x *SetHtmlLinksRequest_SetLinksEntry) MarshalProtoText() string

func (*SetHtmlLinksRequest_SetLinksEntry) ProtoMessage

func (*SetHtmlLinksRequest_SetLinksEntry) ProtoMessage()

func (*SetHtmlLinksRequest_SetLinksEntry) Reset

func (*SetHtmlLinksRequest_SetLinksEntry) String

func (*SetHtmlLinksRequest_SetLinksEntry) UnmarshalJSON

func (x *SetHtmlLinksRequest_SetLinksEntry) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the SetHtmlLinksRequest_SetLinksEntry from JSON.

func (*SetHtmlLinksRequest_SetLinksEntry) UnmarshalProtoJSON

func (x *SetHtmlLinksRequest_SetLinksEntry) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the SetHtmlLinksRequest_SetLinksEntry message from JSON.

type SetHtmlLinksResponse

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

SetHtmlLinksResponse is the response to the SetHtmlLinks request.

func (*SetHtmlLinksResponse) CloneMessageVT

func (*SetHtmlLinksResponse) CloneVT

func (*SetHtmlLinksResponse) EqualMessageVT

func (this *SetHtmlLinksResponse) EqualMessageVT(thatMsg any) bool

func (*SetHtmlLinksResponse) EqualVT

func (this *SetHtmlLinksResponse) EqualVT(that *SetHtmlLinksResponse) bool

func (*SetHtmlLinksResponse) MarshalJSON

func (x *SetHtmlLinksResponse) MarshalJSON() ([]byte, error)

MarshalJSON marshals the SetHtmlLinksResponse to JSON.

func (*SetHtmlLinksResponse) MarshalProtoJSON

func (x *SetHtmlLinksResponse) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the SetHtmlLinksResponse message to JSON.

func (*SetHtmlLinksResponse) MarshalProtoText

func (x *SetHtmlLinksResponse) MarshalProtoText() string

func (*SetHtmlLinksResponse) MarshalToSizedBufferVT

func (m *SetHtmlLinksResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*SetHtmlLinksResponse) MarshalToVT

func (m *SetHtmlLinksResponse) MarshalToVT(dAtA []byte) (int, error)

func (*SetHtmlLinksResponse) MarshalVT

func (m *SetHtmlLinksResponse) MarshalVT() (dAtA []byte, err error)

func (*SetHtmlLinksResponse) ProtoMessage

func (*SetHtmlLinksResponse) ProtoMessage()

func (*SetHtmlLinksResponse) Reset

func (x *SetHtmlLinksResponse) Reset()

func (*SetHtmlLinksResponse) SizeVT

func (m *SetHtmlLinksResponse) SizeVT() (n int)

func (*SetHtmlLinksResponse) String

func (x *SetHtmlLinksResponse) String() string

func (*SetHtmlLinksResponse) UnmarshalJSON

func (x *SetHtmlLinksResponse) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the SetHtmlLinksResponse from JSON.

func (*SetHtmlLinksResponse) UnmarshalProtoJSON

func (x *SetHtmlLinksResponse) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the SetHtmlLinksResponse message from JSON.

func (*SetHtmlLinksResponse) UnmarshalVT

func (m *SetHtmlLinksResponse) UnmarshalVT(dAtA []byte) error

type SetRenderModeRequest

type SetRenderModeRequest struct {

	// RenderMode is the new render mode.
	RenderMode RenderMode `protobuf:"varint,1,opt,name=render_mode,json=renderMode,proto3" json:"renderMode,omitempty"`
	// ScriptPath is a path to a script to load to render.
	// RenderMode_REACT_COMPONENT: expects default export to be a Component.
	// RenderMode_FUNCTION: expects default export to be a ReactNode.
	ScriptPath string `protobuf:"bytes,2,opt,name=script_path,json=scriptPath,proto3" json:"scriptPath,omitempty"`
	// Props is a protobuf message passed as properties to the renderer/component.
	Props []byte `protobuf:"bytes,3,opt,name=props,proto3" json:"props,omitempty"`
	// Refresh clears the existing contents of the view fully before loading the new script.
	Refresh bool `protobuf:"varint,4,opt,name=refresh,proto3" json:"refresh,omitempty"`
	// contains filtered or unexported fields
}

SetRenderModeRequest is the request to change the render mode.

func (*SetRenderModeRequest) CloneMessageVT

func (*SetRenderModeRequest) CloneVT

func (*SetRenderModeRequest) EqualMessageVT

func (this *SetRenderModeRequest) EqualMessageVT(thatMsg any) bool

func (*SetRenderModeRequest) EqualVT

func (this *SetRenderModeRequest) EqualVT(that *SetRenderModeRequest) bool

func (*SetRenderModeRequest) GetProps

func (x *SetRenderModeRequest) GetProps() []byte

func (*SetRenderModeRequest) GetRefresh

func (x *SetRenderModeRequest) GetRefresh() bool

func (*SetRenderModeRequest) GetRenderMode

func (x *SetRenderModeRequest) GetRenderMode() RenderMode

func (*SetRenderModeRequest) GetScriptPath

func (x *SetRenderModeRequest) GetScriptPath() string

func (*SetRenderModeRequest) Logger

func (m *SetRenderModeRequest) Logger(le *logrus.Entry) *logrus.Entry

Logger builds the logger for the request.

func (*SetRenderModeRequest) MarshalJSON

func (x *SetRenderModeRequest) MarshalJSON() ([]byte, error)

MarshalJSON marshals the SetRenderModeRequest to JSON.

func (*SetRenderModeRequest) MarshalProtoJSON

func (x *SetRenderModeRequest) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the SetRenderModeRequest message to JSON.

func (*SetRenderModeRequest) MarshalProtoText

func (x *SetRenderModeRequest) MarshalProtoText() string

func (*SetRenderModeRequest) MarshalToSizedBufferVT

func (m *SetRenderModeRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*SetRenderModeRequest) MarshalToVT

func (m *SetRenderModeRequest) MarshalToVT(dAtA []byte) (int, error)

func (*SetRenderModeRequest) MarshalVT

func (m *SetRenderModeRequest) MarshalVT() (dAtA []byte, err error)

func (*SetRenderModeRequest) ProtoMessage

func (*SetRenderModeRequest) ProtoMessage()

func (*SetRenderModeRequest) Reset

func (x *SetRenderModeRequest) Reset()

func (*SetRenderModeRequest) SizeVT

func (m *SetRenderModeRequest) SizeVT() (n int)

func (*SetRenderModeRequest) String

func (x *SetRenderModeRequest) String() string

func (*SetRenderModeRequest) UnmarshalJSON

func (x *SetRenderModeRequest) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the SetRenderModeRequest from JSON.

func (*SetRenderModeRequest) UnmarshalProtoJSON

func (x *SetRenderModeRequest) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the SetRenderModeRequest message from JSON.

func (*SetRenderModeRequest) UnmarshalVT

func (m *SetRenderModeRequest) UnmarshalVT(dAtA []byte) error

func (*SetRenderModeRequest) Validate

func (m *SetRenderModeRequest) Validate() error

Validate validates the SetRenderModeRequest configuration.

type SetRenderModeResponse

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

SetRenderModeResponse is the response to the SetRenderMode request.

func (*SetRenderModeResponse) CloneMessageVT

func (*SetRenderModeResponse) CloneVT

func (*SetRenderModeResponse) EqualMessageVT

func (this *SetRenderModeResponse) EqualMessageVT(thatMsg any) bool

func (*SetRenderModeResponse) EqualVT

func (this *SetRenderModeResponse) EqualVT(that *SetRenderModeResponse) bool

func (*SetRenderModeResponse) MarshalJSON

func (x *SetRenderModeResponse) MarshalJSON() ([]byte, error)

MarshalJSON marshals the SetRenderModeResponse to JSON.

func (*SetRenderModeResponse) MarshalProtoJSON

func (x *SetRenderModeResponse) MarshalProtoJSON(s *json.MarshalState)

MarshalProtoJSON marshals the SetRenderModeResponse message to JSON.

func (*SetRenderModeResponse) MarshalProtoText

func (x *SetRenderModeResponse) MarshalProtoText() string

func (*SetRenderModeResponse) MarshalToSizedBufferVT

func (m *SetRenderModeResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error)

func (*SetRenderModeResponse) MarshalToVT

func (m *SetRenderModeResponse) MarshalToVT(dAtA []byte) (int, error)

func (*SetRenderModeResponse) MarshalVT

func (m *SetRenderModeResponse) MarshalVT() (dAtA []byte, err error)

func (*SetRenderModeResponse) ProtoMessage

func (*SetRenderModeResponse) ProtoMessage()

func (*SetRenderModeResponse) Reset

func (x *SetRenderModeResponse) Reset()

func (*SetRenderModeResponse) SizeVT

func (m *SetRenderModeResponse) SizeVT() (n int)

func (*SetRenderModeResponse) String

func (x *SetRenderModeResponse) String() string

func (*SetRenderModeResponse) UnmarshalJSON

func (x *SetRenderModeResponse) UnmarshalJSON(b []byte) error

UnmarshalJSON unmarshals the SetRenderModeResponse from JSON.

func (*SetRenderModeResponse) UnmarshalProtoJSON

func (x *SetRenderModeResponse) UnmarshalProtoJSON(s *json.UnmarshalState)

UnmarshalProtoJSON unmarshals the SetRenderModeResponse message from JSON.

func (*SetRenderModeResponse) UnmarshalVT

func (m *SetRenderModeResponse) UnmarshalVT(dAtA []byte) error

type WebView

type WebView interface {
	// GetId returns the web view identifier.
	GetId() string

	// GetParentId returns the id of the parent WebView.
	// May be empty.
	GetParentId() string

	// GetDocumentId returns the id of the parent WebDocument.
	// May be empty.
	GetDocumentId() string

	// GetPermanent returns if the web view is not removable.
	GetPermanent() bool

	// GetClient returns the SRPC client for the remote WebView and other services.
	GetClient() srpc.Client

	// SetRenderMode updates the RenderMode of the WebView.
	SetRenderMode(ctx context.Context, req *SetRenderModeRequest) (*SetRenderModeResponse, error)

	// SetHtmlLinks updates the list of HtmlLink on the WebView.
	SetHtmlLinks(ctx context.Context, req *SetHtmlLinksRequest) (*SetHtmlLinksResponse, error)

	// ResetWebView resets the web view to the initial state.
	ResetWebView(ctx context.Context) error

	// Remove shuts down the WebView and closes the window/tab if possible.
	// Returns ErrWebViewPermanent if the view cannot be closed.
	// Returns context.Canceled if ctx is canceled (but still processes the op)
	// Note: browser windows not created by CreateWebView cannot be closed.
	Remove(ctx context.Context) error
}

WebView is a HTML/CSS/JavaScript container.

Scripts, assets, and raw HTML snippets can be mounted into the view.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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