diff --git a/examples/advanced/main.go b/examples/advanced/main.go new file mode 100644 index 0000000..f860ee0 --- /dev/null +++ b/examples/advanced/main.go @@ -0,0 +1,26 @@ +package main + +import ( + "log" + + "github.com/mattpodraza/webview2/v2/pkg/webview2" +) + +func main() { + wv, err := webview2.New( + webview2.WithTitle("The Go Programming Language"), + webview2.WithMinSize(640, 480), + webview2.WithSize(800, 600), + webview2.WithMaxSize(1280, 720), + webview2.WithDevtools(false), + webview2.WithURL("https://golang.org"), + ) + + if err != nil { + log.Fatalf("Failed to create webview2: %v", err) + } + + if err := wv.Run(); err != nil { + log.Fatalf("Failed while running webview: %v", err) + } +} diff --git a/examples/basic/main.go b/examples/basic/main.go index d7c29fd..6bea809 100644 --- a/examples/basic/main.go +++ b/examples/basic/main.go @@ -3,20 +3,21 @@ package main import ( "log" - "github.com/mattpodraza/webview2/pkg/webview2" + "github.com/mattpodraza/webview2/v2/pkg/webview2" ) func main() { wv, err := webview2.New( - webview2.WithTitle("Minimal webview example"), - webview2.WithSize(800, 600, webview2.HintNone), - webview2.WithURL("https://en.m.wikipedia.org/wiki/Main_Page"), + webview2.WithTitle("The Go Programming Language"), + webview2.WithSize(800, 600), + webview2.WithURL("https://golang.org"), ) if err != nil { log.Fatalf("Failed to create webview2: %v", err) } - // Error handling omitted for brevity - _ = wv.Run() + if err := wv.Run(); err != nil { + log.Fatalf("Failed while running webview: %v", err) + } }