Update README.md

This commit is contained in:
V-X 2019-10-04 19:01:11 -05:00 committed by GitHub
parent bd405e0f93
commit 04e5d36719
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 17 deletions

View File

@ -34,37 +34,37 @@ From `examples/create-react-app/main.go`:
package main package main
import ( import (
"github.com/ImVexed/muon" "github.com/ImVexed/muon"
"cra-go/webfiles" "cra-go/webfiles"
"net/http" "net/http"
) )
func main() { func main() {
// Any static asset packer of your liking (ex. fileb0x) // Any static asset packer of your liking (ex. fileb0x)
fileHandler := http.FileServer(webfiles.HTTP) fileHandler := http.FileServer(webfiles.HTTP)
cfg := &muon.Config{ cfg := &muon.Config{
Title: "Hello, World!", Title: "Hello, World!",
Height: 500, Height: 500,
Width: 500, Width: 500,
Hint: 2 | 4, Hint: 2 | 4,
} }
m := muon.New(cfg, fileHandler) m := muon.New(cfg, fileHandler)
// Expose our `add` function to the JS runtime // Expose our `add` function to the JS runtime
m.Bind("add", add) m.Bind("add", add)
// Show the Window and start the Runtime // Show the Window and start the Runtime
if err := m.Start(); err != nil { if err := m.Start(); err != nil {
panic(err) panic(err)
} }
} }
// Muon automatically handles interop to and from the JS runtime // Muon automatically handles interop to and from the JS runtime
func add(a float64, b float64) float64 { func add(a float64, b float64) float64 {
return a + b return a + b
} }
``` ```