I am working in a react native application in which I have a song list from server. If user click on any song from list then song is started to download from server to local using react-native-fs. In react-native-fs there is a promise which waits to complete the process(downloading) and returns control after that. But mean while I am accessing another promise then it is waiting to complete the process of first promise and then execute. Is there any way so that I can run multiple promise concurrently at same time?
Asked
Active
Viewed 54 times
0
-
Please show us some code. – JLRishe Feb 09 '17 at 07:09
-
`there is a promise which waits to complete the process(downloading) and returns control after that` - no it doesn't - that would make it synchronous! `Is there any way so that I can run multiple promise concurrently at same time?` yes, promises are asynchronous, so therefore you can "run" as many promises as your memory allows – Jaromanda X Feb 09 '17 at 08:32
-
no but its not happening in my case – Akhilesh Mourya Feb 09 '17 at 09:12
-
Thank you! in android all react native methods execute synchronously so I just created a thread in native code and put download process in that and then my problem is resolved – Akhilesh Mourya Feb 09 '17 at 18:07