gui-demo/tutorial02/main.go

17 lines
479 B
Go

package main
import "github.com/webview/webview"
func main() {
w := webview.New(true)
defer w.Destroy()
w.SetSize(300, 200, webview.HintFixed)
// Create a GoLang function callable from JS
w.Bind("hello", func() string {
return "World!"
})
// Create UI with data URI
w.Navigate(`data:text/html, <!doctype html> <html> <head><title>Hello</title></head> <body><h1>Hello, world!</h1></body> <script> hello().then((x) => { console.log(x) }) </script> </html>`)
w.Run()
}