mirror of
https://github.com/taigrr/wasm-experiments
synced 2025-01-18 04:03:21 -08:00
Add jsgo.io example
This commit is contained in:
20
jsgo/main.go
Normal file
20
jsgo/main.go
Normal file
@@ -0,0 +1,20 @@
|
||||
// +build js,wasm
|
||||
|
||||
package main
|
||||
|
||||
import "syscall/js"
|
||||
|
||||
var document js.Value
|
||||
|
||||
func init() {
|
||||
document = js.Global().Get("document")
|
||||
}
|
||||
|
||||
func main() {
|
||||
div := document.Get("body")
|
||||
|
||||
node := document.Call("createElement", "div")
|
||||
node.Set("innerHTML", "Hello jsgo.io!")
|
||||
|
||||
div.Call("appendChild", node)
|
||||
}
|
||||
Reference in New Issue
Block a user