Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DispatchCallback ¶
type DispatchCallback func()
type ScriptCallback ¶
type ScriptCallback func(string)
type WebView ¶
type WebView struct {
// contains filtered or unexported fields
}
Example ¶
package main import ( "github.com/KnownUnown/webview" "net/url" ) func main() { v := webview.New() u, _ := url.Parse("https://google.com") v.Navigate(u) v.Loop() }
Output:
func (*WebView) AddUserScript ¶
AddUserScript registers the given string as a user script, that is, a script that is persistent across many Navigate calls or page loads.
func (*WebView) Dispatch ¶
func (v *WebView) Dispatch(cb DispatchCallback)
Dispatch runs the given function on the main thread at some point in the future.
func (*WebView) Loop ¶
func (*WebView) Loop()
Loop pumps the NSApp run loop, namely, it calls `[NSApp run]`. This function must be called from the main thread to run the WebView after you create it. It blocks until the app exits.
func (*WebView) SetScriptCallback ¶
func (v *WebView) SetScriptCallback(cb ScriptCallback)
SetScriptCallback registers a function to be called whenever JavaScript calls `window.webkit.messageHandlers.webview.postMessage`.
Click to show internal directories.
Click to hide internal directories.