Documentation
¶
Index ¶
- Constants
- type EventHandler
- type EventType
- type Hint
- type Webview
- func (webview Webview) Bind(name string, f interface{}) errordeprecated
- func (webview Webview) Destroy()deprecated
- func (webview Webview) Dispatch(f func())deprecated
- func (webview Webview) Eval(js string)
- func (webview Webview) Init(js string)
- func (webview Webview) Navigate(uri string)
- func (webview Webview) OnEvent(handler interface{})
- func (webview *Webview) Run(f func(webview *Webview))
- func (webview Webview) SetSize(w int, h int, hint webview.Hint)
- func (webview Webview) SetTitle(title string)
- func (webview Webview) Terminate()
- func (webview *Webview) WaitForClose() (safeToClose chan<- interface{})
- func (webview Webview) Window() unsafe.Pointerdeprecated
- type WindowBlur
- type WindowBlurEventHandler
- type WindowEnterEventHandler
- type WindowFocus
- type WindowFocusEventHandler
- type WindowLeaveEventHandler
- type WindowMouseEnter
- type WindowMouseLeave
- type WindowResize
- type WindowResizeEventHandler
Constants ¶
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type EventHandler ¶
type Webview ¶
func New ¶
New Creates a gofunc/threading safe thread-alone webview and window
debug: If debug is non-zero - developer tools will be enabled (if the platform supports them)
func (Webview) Bind
deprecated
Bind binds a callback function so that it will appear under the given name as a global JavaScript function. Internally it uses webview_init(). Callback receives a request string and a user-provided argument pointer. Request string is a JSON array of all the arguments passed to the JavaScript function.
f must be a function f must return either value and error or just error
Deprecated: Drop-in support
func (Webview) Eval ¶
Eval evaluates arbitrary JavaScript code. Evaluation happens asynchronously, also the result of the expression is ignored. Use RPC bindings if you want to receive notifications about the results of the evaluation.
func (Webview) Init ¶
Init injects JavaScript code at the initialization of the new page. Every time the webview will open a new page - this initialization code will be executed. It is guaranteed that code is executed before window.onload. Appends to the init code.
func (Webview) Navigate ¶
Navigate navigates webview to the given URI. URI may be a data URI, i.e. "data:text/html,<html>...</html>". It is often ok not to url-encode it properly, webview will re-encode it for you.
func (Webview) OnEvent ¶
func (webview Webview) OnEvent(handler interface{})
OnEvent adds an event handler on a specific type of event and runs the handler in a go func
func (*Webview) Run ¶
Run Sets the webview to run in a standalone thread and handles destruction of the webview. f: An arbitrary function to run in a new thread, use WaitForClose in the thread.
Blocking but you can call WaitForClose in other functions, thread safe
func (Webview) SetTitle ¶
SetTitle updates the title of the native window. Must be called from the UI thread.
func (Webview) Terminate ¶
func (webview Webview) Terminate()
Terminate stops the main loop. It is safe to call this function from a background thread.
Nothing after this is called is guaranteed to run, use WaitForClose to confirm completion of tasks.
func (*Webview) WaitForClose ¶
func (webview *Webview) WaitForClose() (safeToClose chan<- interface{})
WaitForClose Waits for the webview window to be closed before returning, can be called as much as wanted.
Returns safeToClose which is a channel waiting for the first message sent to determine if it is safe to close the window ¶
safeToClose needs to be sent something in order for the main thread to continue after Run
func (Webview) Window
deprecated
type WindowBlur ¶
type WindowBlur struct { }
type WindowBlurEventHandler ¶
type WindowBlurEventHandler func(webview *Webview, blur *WindowBlur)
func (WindowBlurEventHandler) Handle ¶
func (i WindowBlurEventHandler) Handle(webview *Webview)
func (WindowBlurEventHandler) Type ¶
func (i WindowBlurEventHandler) Type() EventType
type WindowEnterEventHandler ¶
type WindowEnterEventHandler func(webview *Webview, enter *WindowMouseEnter)
func (WindowEnterEventHandler) Handle ¶
func (i WindowEnterEventHandler) Handle(webview *Webview)
func (WindowEnterEventHandler) Type ¶
func (i WindowEnterEventHandler) Type() EventType
type WindowFocus ¶
type WindowFocus struct { }
type WindowFocusEventHandler ¶
type WindowFocusEventHandler func(webview *Webview, focus *WindowFocus)
func (WindowFocusEventHandler) Handle ¶
func (i WindowFocusEventHandler) Handle(webview *Webview)
func (WindowFocusEventHandler) Type ¶
func (i WindowFocusEventHandler) Type() EventType
type WindowLeaveEventHandler ¶
type WindowLeaveEventHandler func(webview *Webview, leave *WindowMouseLeave)
func (WindowLeaveEventHandler) Handle ¶
func (i WindowLeaveEventHandler) Handle(webview *Webview)
func (WindowLeaveEventHandler) Type ¶
func (i WindowLeaveEventHandler) Type() EventType
type WindowMouseEnter ¶
type WindowMouseEnter struct { }
type WindowMouseLeave ¶
type WindowMouseLeave struct { }
type WindowResize ¶
type WindowResize struct { }
type WindowResizeEventHandler ¶
type WindowResizeEventHandler func(webview *Webview, resize *WindowResize)
func (WindowResizeEventHandler) Handle ¶
func (i WindowResizeEventHandler) Handle(webview *Webview)
func (WindowResizeEventHandler) Type ¶
func (i WindowResizeEventHandler) Type() EventType