github.com/tinygo-org/tinygo@v0.31.3-0.20240404173401-90b0bf646c27/src/examples/wasm/invoke/wasm.go (about) 1 package main 2 3 import ( 4 "syscall/js" 5 ) 6 7 func runner(this js.Value, args []js.Value) interface{} { 8 return args[0].Invoke(args[1]).String() 9 } 10 11 func main() { 12 wait := make(chan struct{}, 0) 13 js.Global().Set("runner", js.FuncOf(runner)) 14 <-wait 15 }