giowebview

package
v0.0.0-...-dd13eba Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2023 License: BSD-3-Clause, MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConfigFromViewEvent

func NewConfigFromViewEvent(w *app.Window, evt app.ViewEvent) webview.Config

NewConfigFromViewEvent creates a webview.Config based on app.ViewEvent.

func Plugin

func Plugin(w *app.Window, evt event.Event)

Plugin hijacks Gio events and wraps them in WebView events. You must call at the beginning of your window.Event function, like this:

for evt := range w.Events() {
	giowebview.Plugin(w, evt)

    switch evt := evt.(type) {
    // ...
    }
}

Types

type CookiesEvent

type CookiesEvent struct {
	Cookies []webview.CookieData
}

CookiesEvent is the event sent when ListCookieOp is executed.

func (CookiesEvent) ImplementsEvent

func (c CookiesEvent) ImplementsEvent()

ImplementsEvent the event.Event interface.

type ExecuteJavascriptOp

type ExecuteJavascriptOp struct {
	Script string
}

ExecuteJavascriptOp executes given JavaScript in the webview.

func (ExecuteJavascriptOp) Add

func (o ExecuteJavascriptOp) Add(op *op.Ops)

Add adds a new ExecuteJavascriptOp to the queue.

type InstallJavascriptOp

type InstallJavascriptOp struct {
	Script string
}

InstallJavascriptOp installs given JavaScript in the webview, executing it every time the webview loads a new page. The script is executed before the page is fully loaded.

func (InstallJavascriptOp) Add

func (o InstallJavascriptOp) Add(op *op.Ops)

Add adds a new ExecuteJavascriptOp to the queue.

type ListCookieOp

type ListCookieOp struct {
	Tag event.Tag
}

ListCookieOp lists all cookies in the webview. The response in sent via CookiesEvent using the provided Tag.

func (ListCookieOp) Add

func (o ListCookieOp) Add(op *op.Ops)

Add adds a new ListCookieOp to the queue.

type ListStorageOp

type ListStorageOp struct {
	Local StorageType
	Tag   event.Tag
}

ListStorageOp lists all Storage in the webview. The response in sent via StorageEvent using the provided Tag.

func (ListStorageOp) Add

func (o ListStorageOp) Add(op *op.Ops)

Add adds a new ListStorageOp to the queue.

type MessageEvent

type MessageEvent struct {
	Message string
}

MessageEvent is the event sent when receiving a message, from previously defined MessageReceiverOp.

func (MessageEvent) ImplementsEvent

func (c MessageEvent) ImplementsEvent()

ImplementsEvent the event.Event interface.

type MessageReceiverOp

type MessageReceiverOp struct {
	Name string
	Tag  event.Tag
}

MessageReceiverOp receives a message from the webview, and sends it to the provided Tag. The message is sent as a string.

You can use this to communicate with the webview, by using:

window.callback.<name>(<message>);

Consider that <name> is the provided Name of the callback, and <message> is the message to send to Tag.

For further information, see webview.JavascriptManager.

func (MessageReceiverOp) Add

func (o MessageReceiverOp) Add(op *op.Ops)

Add adds a new ExecuteJavascriptOp to the queue.

type NavigateOp struct {
	// URL is the URL to redirect to.
	URL string
}

NavigateOp redirects the last Display to the given URL. If the URL have unknown protocols, or malformed URL may lead to unknown behaviors.

func (o NavigateOp) Add(op *op.Ops)

Add adds a new NavigateOp to the queue.

type NavigationEvent webview.NavigationEvent

NavigationEvent is issued when the webview change the URL.

func (NavigationEvent) ImplementsEvent()

ImplementsEvent the event.Event interface.

type OffsetOp

type OffsetOp struct {
	Point f32.Point
}

OffsetOp moves the webview by the specified offset.

func Offset

func Offset[POINT image.Point | f32.Point](v POINT) OffsetOp

Offset creates a new OffsetOp.

func (OffsetOp) Add

func (o OffsetOp) Add(op *op.Ops)

Add adds a new OffsetOp to the queue.

type RectOp

type RectOp struct {
	Size           f32.Point
	SE, SW, NW, NE float32
}

RectOp shows the webview into the specified area. The RectOp is not context-aware, and will overlay any other widget on the screen.

RectOp also takes the foreground and clicks events and keyboard events will not be routed to Gio.

Performance: changing the size/bounds or radius can be expensive. If applicable, change the Rect, instead of changing the size.

Only one RectOp can be active at each frame for the same WebViewOp.

func Rect

func Rect[POINT image.Point | f32.Point](v POINT) RectOp

Rect creates a new RectOp.

func (RectOp) Add

func (o RectOp) Add(op *op.Ops)

Add adds a new RectOp to the queue.

type RemoveCookieOp

type RemoveCookieOp struct {
	Cookie webview.CookieData
}

RemoveCookieOp sets given cookie in the webview.

func (RemoveCookieOp) Add

func (o RemoveCookieOp) Add(op *op.Ops)

Add adds a new SetCookieOp to the queue.

type RemoveStorageOp

type RemoveStorageOp struct {
	Local   StorageType
	Content webview.StorageData
}

RemoveStorageOp sets given Storage in the webview.

func (RemoveStorageOp) Add

func (o RemoveStorageOp) Add(op *op.Ops)

Add adds a new SetStorageOp to the queue.

type SetCookieOp

type SetCookieOp struct {
	Cookie webview.CookieData
}

SetCookieOp sets given cookie in the webview.

func (SetCookieOp) Add

func (o SetCookieOp) Add(op *op.Ops)

Add adds a new SetCookieOp to the queue.

type SetStorageOp

type SetStorageOp struct {
	Local   StorageType
	Content webview.StorageData
}

SetStorageOp sets given Storage in the webview.

func (SetStorageOp) Add

func (o SetStorageOp) Add(op *op.Ops)

Add adds a new SetStorageOp to the queue.

type StorageEvent

type StorageEvent struct {
	Storage []webview.StorageData
}

StorageEvent is the event sent when ListStorageOp is executed.

func (StorageEvent) ImplementsEvent

func (c StorageEvent) ImplementsEvent()

ImplementsEvent the event.Event interface.

type StorageType

type StorageType int

StorageType is the type of storage.

const (
	// StorageTypeLocal is the local storage.
	StorageTypeLocal StorageType = iota
	// StorageTypeSession is the session storage.
	StorageTypeSession
)

type TitleEvent

type TitleEvent webview.TitleEvent

TitleEvent is issued when the webview change the title.

func (TitleEvent) ImplementsEvent

func (TitleEvent) ImplementsEvent()

ImplementsEvent the event.Event interface.

type WebViewOp

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

WebViewOp shows the webview into the specified area. The RectOp is not context-aware, and will overlay any other widget on the screen.

WebViewOp also takes the foreground and clicks events and keyboard events will not be routed to Gio.

Performance: changing the size/bounds or radius can be expensive. If applicable, change the Offset, instead of changing the size.

func NewWebViewOp

func NewWebViewOp() *WebViewOp

NewWebViewOp creates a new WebViewOp.

func (WebViewOp) Pop

func (o WebViewOp) Pop(op *op.Ops)

Pop stops using the WebViewOp.

func (WebViewOp) Push

func (o WebViewOp) Push(op *op.Ops) WebViewOp

Push adds a new WebViewOp to the queue, any subsequent Ops (sucha as RectOp) will affect this WebViewOp. In order to stop using this WebViewOp, call Pop.

Jump to

Keyboard shortcuts

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