What is the best way to pass Clojure vectors and maps to JavaScript
functions?
Currently when I need to call a JavaScript function that takes an
array I do something like
(js/my_js_fn (.array (vector 1 2 3)))
and I pass Clojure maps like
(js/my_js_fn (.strobj (hash-map "a" 1 "b" 2)))
This feels a bit gross, since I'm digging into the implementation
details.
Is there a recommended way to do this yet?
Some kind of reader macro (say @@) would be okay, turning
(js/my_js_fn @@(vector 1 2 3))
into
(js/my_js_fn (.array (vector 1 2 3)))
at read time.
Ideally though, the compiler would automatically convert ClojureScript
objects into JavaScript native objects when they're passed to a
function in the js/ namespace.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en