forked from jchv/go-webview2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
43 lines (41 loc) · 793 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
webview "github.com/shmspace/webview2"
"log"
"time"
)
func main() {
var w webview.WebView
go func() {
w = webview.NewWithOptions(webview.WebViewOptions{
Debug: true,
AutoFocus: true,
WindowOptions: webview.WindowOptions{
Title: "Minimal webview example",
Width: 800,
Height: 600,
IconId: 2, // icon resource id
Center: true,
},
})
if w == nil {
log.Fatalln("Failed to load webview.")
}
defer w.Destroy()
w.SetSize(800, 600, webview.HintFixed)
w.Navigate("https://www.taobao.com")
w.Run()
}()
go func() {
for {
time.Sleep(3 * time.Second)
w.Show()
//w.Show()
time.Sleep(3 * time.Second)
w.Hide()
w.Navigate("https://www.baidu.com")
//w.Hide()
}
}()
time.Sleep(5 * time.Minute)
}