@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<title>Example</title>
<title>Golang-WASM</title>
</head>
<body>
@ -13,19 +13,8 @@ func main() {
<-c
}
const hello = "Sample value"
func helloName(_ js.Value, args []js.Value) interface{} {
return fmt.Sprintf("Hello, %s!", args[0].String())
func setup() {
bridge := js.Global().Get("__go_wasm__")
fmt.Println("golang-wasm initialized")
bridge.Set("__ready__", true)
bridge.Set("hello", hello)
bridge.Set("helloName", js.FuncOf(helloName))
js.Global()
@ -1,11 +1,11 @@
{
"name": "go-mod-wasm",
"name": "golang-wasm",
"version": "0.1.0",
"version": "0.0.1",
"description": "A webpack-based configuration to work with wasm using Go.",
"main": "src/index.js",
"repository": {
"type": "git",
"url": "https://gitea.teamortix.com/Team-Ortix/go-mod-wasm"
"url": "https://gitea.teamortix.com/Team-Ortix/golang-wasm"
},
"keywords": [
"golang",