fix walltimne

This commit is contained in:
vedhavyas committed 2019-08-20 13:47:40 -07:00
1 parent 4f9c552ed7
commit 26ad7c8f0b
5 files changed
+22 -10

No files matched your search

+2 -3
View File
@@ -1,7 +1,6 @@
package main
import (
"fmt"
"log"
wasmgo "github.com/vedhavyas/wasm"
@@ -9,7 +8,7 @@ import (
func proxy(b *wasmgo.Bridge) wasmgo.Func {
return func(args []interface{}) (i interface{}, e error) {
fmt.Println("In Go", args)
log.Println("In Go", args)
return b.CallFunc("addition", args)
}
}
@@ -33,5 +32,5 @@ func main() {
}
<-done
fmt.Println("wasm exited", err)
log.Println("wasm exited", err)
}
+3 -3
View File
@@ -3,13 +3,13 @@
package main
import (
"fmt"
"log"
"syscall/js"
)
// TODO: log seems to cause an issue
func addition(this js.Value, args []js.Value) interface{} {
fmt.Println("In WASM", args)
log.Println("In WASM", args)
a, b := args[0].Int(), args[1].Int()
return a + b
}
@@ -22,6 +22,6 @@ func main() {
js.Global().Set("addition", fun)
res := js.Global().Get("proxy").Invoke(1, 2)
fmt.Printf("1 + 2 = %d\n", res.Int())
log.Printf("1 + 2 = %d\n", res.Int())
<-ch
}
Binary file not shown.