iris/_examples/webassembly/basic/client/hello_go114.go
Gerasimos (Makis) Maropoulos cc19f80049 update some examples
Former-commit-id: 2ed7c323dd379eb68d5ccb2044cd9cc772ce0b08
2020-05-05 22:03:01 +03:00

17 lines
406 B
Go

// +build js
package main
import (
"fmt"
"syscall/js"
"time"
)
func main() {
// GOARCH=wasm GOOS=js /home/$yourusername/go1.14/bin/go build -o hello.wasm hello_go114.go
js.Global().Get("console").Call("log", "Hello WebAssemply!")
message := fmt.Sprintf("Hello, the current time is: %s", time.Now().String())
js.Global().Get("document").Call("getElementById", "hello").Set("innerText", message)
}