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/
you can write them in JS and use them from CLJS, writing them in CLJS is not possible
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.
you shouldn't have interop problems - certainly not callbacks
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
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.
I think that is of fairly limited use since those "worklets" or threads still cannot share memory
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
Yes, very valid concern. I’m a bit desperate to try it out though ;) Will report back, even if just for academic purpose :)
@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;