init
This commit is contained in:
commit
dc30ed49d9
|
|
@ -0,0 +1,9 @@
|
|||
module myschools.me/suguo/gui-demo
|
||||
|
||||
go 1.17
|
||||
|
||||
require (
|
||||
github.com/webview/webview v0.0.0-20210330151455-f540d88dde4e // indirect
|
||||
github.com/zserge/lorca v0.1.10 // indirect
|
||||
golang.org/x/net v0.0.0-20210924151903-3ad01bbaa167 // indirect
|
||||
)
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
github.com/webview/webview v0.0.0-20210330151455-f540d88dde4e h1:z780M7mCrdt6KiICeW9SGirvQjxDlrVU+n99FO93nbI=
|
||||
github.com/webview/webview v0.0.0-20210330151455-f540d88dde4e/go.mod h1:rpXAuuHgyEJb6kXcXldlkOjU6y4x+YcASKKXJNUhh0Y=
|
||||
github.com/zserge/lorca v0.1.10 h1:f/xBJ3D3ipcVRCcvN8XqZnpoKcOXV8I4vwqlFyw7ruc=
|
||||
github.com/zserge/lorca v0.1.10/go.mod h1:bVmnIbIRlOcoV285KIRSe4bUABKi7R7384Ycuum6e4A=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/net v0.0.0-20200222125558-5a598a2470a0/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20210924151903-3ad01bbaa167 h1:eDd+TJqbgfXruGQ5sJRU7tEtp/58OAx4+Ayjxg4SM+4=
|
||||
golang.org/x/net v0.0.0-20210924151903-3ad01bbaa167/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
|
||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"log"
|
||||
"net/url"
|
||||
|
||||
"github.com/zserge/lorca"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// Create UI with basic HTML passed via data URI
|
||||
ui, err := lorca.New("data:text/html,"+url.PathEscape(`
|
||||
<html>
|
||||
<head><title>Hello</title></head>
|
||||
<body><h1>Hello, world!</h1></body>
|
||||
</html>
|
||||
`), "", 480, 320)
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
defer ui.Close()
|
||||
// Wait until UI window is closed
|
||||
<-ui.Done()
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
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()
|
||||
}
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
package main
|
||||
|
||||
import "github.com/webview/webview"
|
||||
|
||||
func main() {
|
||||
debug := true
|
||||
w := webview.New(debug)
|
||||
defer w.Destroy()
|
||||
w.SetTitle("Minimal webview example")
|
||||
w.SetSize(1024, 768, webview.HintNone)
|
||||
w.Navigate("http://www.myschools.me")
|
||||
w.Run()
|
||||
}
|
||||
Loading…
Reference in New Issue