having this go function
func WasmCount(this js.Value, args []js.Value) interface {} {
const firstParam = args[0].ArrayOfString() // <-- I want to achieve this
return firstParam.Length
}
and I will call it from js like this
WasmCount(["a", "b"]) // it should return 2
I can pass String and Int but didn't find a way to pass an Array of <T>
It's the go code's responsibility to extract the slice from a
js.Value. See the demo below:This demo is modified from this answer: https://stackoverflow.com/a/76082718/1369400.