add functions

This commit is contained in:
vedhavyas committed 2019-08-19 21:13:53 -04:00
1 parent 771a2d95cf
commit fbfa1a0c93
5 files changed
+244 -73

No files matched your search

+7 -5
View File
@@ -7,17 +7,19 @@ import (
"syscall/js"
)
// TODO: log seems to cause an issue
func printWasm(this js.Value, v []js.Value) interface{} {
fmt.Println("Hello from WASM", v)
return nil
}
func main() {
c := make(chan struct{}, 0)
fmt.Println("WASM Go Initialized")
ch := make(chan bool)
//fmt.Println("WASM Go Initialized")
// register functions
js.Global().Set("printWasm", js.FuncOf(printWasm))
fmt.Println("Done...")
<-c
fun := js.FuncOf(printWasm)
js.Global().Set("printWasm", fun)
//fmt.Println("Done...")
<-ch
}
Binary file not shown.