This commit is contained in:
vedhavyas committed 2019-08-21 19:24:07 -07:00
1 parent 2a22ca2a7f
commit 6029286b43
5 files changed
+74 -32

No files matched your search

+7 -3
View File
@@ -13,14 +13,18 @@ func addition(this js.Value, args []js.Value) interface{} {
return a + b
}
func multiplier(this js.Value, args []js.Value) interface{} {
return 10
}
func main() {
ch := make(chan bool)
// register functions
fun := js.FuncOf(addition)
js.Global().Set("addition", fun)
js.Global().Set("addition", js.FuncOf(addition))
js.Global().Set("multiplier", js.FuncOf(multiplier))
res := js.Global().Get("proxy").Invoke(1, 2)
res := js.Global().Get("addProxy").Invoke(1, 2)
log.Printf("1 + 2 = %d\n", res.Int())
<-ch
}
Binary file not shown.