| 1 | //go:build windows |
| 2 | |
| 3 | package main |
| 4 | |
| 5 | import ( |
| 6 | "sync" |
| 7 | |
| 8 | "github.com/wailsapp/go-webview2/webviewloader" |
| 9 | ) |
| 10 | |
| 11 | var ( |
| 12 | webView2RuntimeOnce sync.Once |
| 13 | webView2RuntimeCached string |
| 14 | ) |
| 15 | |
| 16 | func webView2RuntimeVersion() string { |
| 17 | webView2RuntimeOnce.Do(func() { |
| 18 | version, err := webviewloader.GetAvailableCoreWebView2BrowserVersionString("") |
| 19 | if err == nil { |
| 20 | webView2RuntimeCached = version |
| 21 | } |
| 22 | }) |
| 23 | return webView2RuntimeCached |
| 24 | } |
| 25 |