cljsrn

https://github.com/drapanjanas/re-natal | https://github.com/drapanjanas/re-natal/wiki/FAQ | https://github.com/condense/mercury-app/wiki | https://github.com/seantempesta/expo-cljs-template/ https://www.npmjs.com/package/create-expo-cljs-app
ullrich 2021-05-13T19:44:15.343600Z

Did anybody look into possibilities to use re-animated worklets with cljs? They require a Babel transpiration step and I’m wondering what it would take to make them work with shadow or krell. https://docs.swmansion.com/react-native-reanimated//react-native-reanimated/docs/worklets/

thheller 2021-05-13T19:45:23.344Z

you can write them in JS and use them from CLJS, writing them in CLJS is not possible

ullrich 2021-05-13T19:56:22.349900Z

So I would write them in JS, transpile and then require the result in shadow? I wonder how callbacks would work though. I think I need to take a look at the transpilation result to get a better idea of them.

dnolen 2021-05-13T19:57:22.350400Z

you shouldn't have interop problems - certainly not callbacks

dnolen 2021-05-13T19:58:18.351200Z

been working on a project for over a year where all UI components are written in JS, not just 3rd party stuff from libs - no issues

1
ullrich 2021-05-13T20:09:34.357600Z

I’m actually looking into the possibilities that https://github.com/mrousavy/react-native-multithreading offers for loading of heavy work off of the JS thread. They use the same worklet API. It doesn’t assume callbacks though, but returns the result as a promise. I’ll play with it a bit. I’m just starting to look into this and haven’t fully sunk my mind into it yet. wondering if it would be possible to call an exported CLJS fn from the JS worklet. Would love to keep my logic in Clojure.

thheller 2021-05-13T20:10:04.358200Z

I think that is of fairly limited use since those "worklets" or threads still cannot share memory

thheller 2021-05-13T20:10:47.359100Z

so as soon as you need access to data in those you'll pay serialization costs, which quite often will make things actually slower and not worth it

ullrich 2021-05-13T20:13:32.361100Z

Yes, very valid concern. I’m a bit desperate to try it out though ;) Will report back, even if just for academic purpose :)

raspasov 2021-05-13T20:20:27.366700Z

@ullrich.schaefer I also wanted to use worklets from pure CLJS but it’s not really possible; one thing that works is that you can pass CLJS fn to the JS side and call the fn there; works easily for JS primitives etc; if you want your CLJS function to accept CLJS data, that would be more involved, I think, and not sure if it’s easily possible; but just primitives or JS objects should be good enough for most cases;

👍 1