Closed HildingElmqvist closed 11 months ago
The Externref
isn't directly usable within Julia. You can only pass it back to JavaScript. You should be able to call JS._get(initial, 1, Float64)
to extract an element from the JS array.
Wait. There's an easier way. You should be able to get that array in Julia with Vector{Float64}(initial)
.
Let me know if that doesn't work.
Thanks for your quick suggestions!
No, Vector{Float64}(initial) did not work. The compilation script returns too quickly without any error message.
JS._get(initial, 2, Float64) works. Is there a way of getting the size of the array or I have to query that separately?
Try:
n = @jscall("x => x.length", Int32, Tuple{Externref}, jsa)
I need to fix and add a test case for Vector{T}
.
n = @jscall("x => x.length", Int32, Tuple{Externref}, jsa)
worked fine.
Thanks a lot!
I want to allow entering the initial conditions in the web app. I thus want to call a Javscript function which returns a vector from Julia: `
`
I declared the return type as Externref:
initial = @jscall("getInitial", Externref, Tuple{})
I added some logging:`
`
I am not able to pick up the first element of the vector. I get:
`
Is this supposed to work or is there any work around?