w := New(true) defer w.Destroy() w.SetTitle("Hello") w.Bind("noop", func() string { log.Println("hello") return "hello" }) w.Bind("add", func(a, b int) int { return a + b }) w.Bind("quit", func() { w.Terminate() }) w.SetHtml(`<!doctype html> <html> <body>hello</body> <script> window.onload = function() { document.body.innerText = ` + "`hello, ${navigator.userAgent}`" + `; noop().then(function(res) { console.log('noop res', res); add(1, 2).then(function(res) { console.log('add res', res); quit(); }); }); }; </script> </html> )`) w.Run()
func NewWindow(debug bool, window unsafe.Pointer) WebView
This section is empty.
This section is empty.
Hints are used to configure window sizing and resizing
New calls NewWindow to create a new window and a new webview instance. If debug is non-zero - developer tools will be enabled (if the platform supports them).
NewWindow creates a new webview instance. If debug is non-zero - developer tools will be enabled (if the platform supports them). Window parameter can be a pointer to the native window handle. If it's non-null - then child WebView is embedded into the given parent window. Otherwise a new window is created. Depending on the platform, a GtkWindow, NSWindow or HWND pointer can be passed here.