Fork me on GitHub
#squint
<
2024-02-24
>
pez11:02:11

Hi! In a regular ClojureScript project I have just spent some time rewriting a piece of code to work on a JS object instead of Clojure clojure data. The reason is that I need to set the result on a JS object from a library I am using. Basically what I had was: • cljs-ajax:clj-data -> transform -> clj->js -> set-on-js-library-object And now I have: • cljs-ajax:raw-js -> transform -> set-on-js-library-object The payload is pretty big so the clj->js step took too much time. I leveraged applied-science/js-interop for this and the new transform code is not too horrible, but still… I need to be really careful not to miss a #js tag somewhere, or forget to do into-array on some result from a map or filter or whatever. I.e. There is a bit too much code there that does not deal with the business problem I am trying to solve. Now to my question. 😃 Has anyone leveraged squint for this kind of task? (Please let me know if “this kind of task” is unclear.) I’m thinking that the transform code would stay pretty close to the original one I had, and be less error prone expressed in squint CLJS.

borkdude12:02:56

js-interop has a macro for this called js I believe not sure how well it works, since it's marked experimental, but may be worth a try https://github.com/applied-science/js-interop/pull/32

👀 2
pez12:02:02

Oh, wow, thanks! 🙏

pez13:02:34

It is very nice! Could wish for an even deeper js-mode. I still need to do the into-array stuff. But things are much cleaner than with the the interop-y version.