Skip to content
This repository has been archived by the owner on Feb 28, 2023. It is now read-only.

Commit

Permalink
docs: update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mattpodraza committed May 15, 2021
1 parent 771d662 commit 128fafe
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 6 deletions.
26 changes: 26 additions & 0 deletions examples/advanced/main.go
Original file line number Diff line number Diff line change
@@ -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)
}
}
13 changes: 7 additions & 6 deletions examples/basic/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

0 comments on commit 128fafe

Please sign in to comment.