Multithreading.


#1

Anyone have idea about implementing multithreading ?


#2

Hi @sreeram123. Javascript is single threaded, so full multithreading will probably never be implemented. There are APIs such as Web Workers that will probably be supported by Expo in the future.


#3

Yes @jesse , i know that but is there any alternative as of now , as i am developing an app where i don’t want to block js thread, i am implementing promise for asynchronous operations but i have multiple asynchronous operations firing together which is blocking ui onpress operations.
So can you suggest any way ? The application which i am developing is similar to feeds/posts like facebook but with multiple type of feeds on multiple tabs loaded onload.


#4

Sounds like you might want to use https://developer.mozilla.org/en-US/docs/Web/API/Window/requestIdleCallback. Is that what you’re looking for?


#5

@jesse: Yes , i read it, it’s only when there is a idle period. if i want to spawn parallel execution then that won’t be possible. Can you please tell me does react native has any dependency for execution on nodejs, if so then can nodejs worker threads can be implemented in expo ?


#6

@sreeram123 React Native doesn’t currently support Node’s APIs like worker threads. If this is an important feature for you, could you please open a feature request so we can track it?


#7

@dikaiosune:- Thanks for information, i actually just wanted a clarification for different way for multithreading in react native and i feel I got clarified with your information.
Thank you very much , but just check in near future whether parallel execution can be implemented in react native because it’s only the short of this feature which is affecting performance sometimes.


closed #8

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.