What I would like to do is to execute these tasks in a “low priority” manner, so that they never block the main UI thread and hinder the user experience.
Note that I am NOT currently looking into background execution, e.g. the app can remain open while the transfer is ongoing and when the app is closed, the transfer can be aborted.
If it’s a lot of data, you’ll probably want to be more aware of not taking up too much bandwidth/ battery before you worry about bogging down the UI. To that end, you could regulate the frequency of how often you fire requests (e.g., sleep X seconds/ minutes between requests).
Thanks, solid advice. If uploading images through a REST-request doesn’t block the JS thread, I don’t think I’ll be in trouble. I’ve also rearranged (denormalized) the data a bit so that reads run more quickly when the processes need to do their work.
Still wonder how you would go about heavy client-side processing, such as image manipulation. Not an urgent concern anymore though.
If you mean stuff you would do with ImageManipulator (ImageManipulator - Expo Documentation), that’s also executed asynchronously, handled on another native thread.
More like working on the raw data yourself, eg running a convolution over the image signal. We might want to implement some custom filters in future.
Promise.all(). Additionally, there are libraries like https://github.com/devfd/react-native-workers, which requires ejecting (if you’re looking at custom image manipulation, you’re already likely considering ejecting, though).
This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.