rename to examples

This commit is contained in:
vedhavyas committed 2019-08-20 14:41:49 -07:00
1 parent bf35d691af
commit 2a22ca2a7f
3 files changed
+3 -3

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
// +build js,wasm
package main
import (
"log"
"syscall/js"
)
func addition(this js.Value, args []js.Value) interface{} {
log.Println("In WASM", args)
a, b := args[0].Int(), args[1].Int()
return a + b
}
func main() {
ch := make(chan bool)
// register functions
fun := js.FuncOf(addition)
js.Global().Set("addition", fun)
res := js.Global().Get("proxy").Invoke(1, 2)
log.Printf("1 + 2 = %d\n", res.Int())
<-ch
}
BIN
View File
Binary file not shown.