Click here to Skip to main content
15,892,537 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have two functions as below example.

function CallAsysnc(){

FirstFun(); // 1st function
SecondFun(); //2nd function
}

if i run this code then as we know javascript run in a single thread but i need asynchronous call.
even how can i call js files parallel? or how could it be done using async.js?

will appreciate your response.
Many Thanks!

Regards
Gaurv
Posted

As you mentioned JavaScript is single threaded, and there is no real asynchronous function call in it...However you may use setTimeout[^] to run function without waiting to its return...
 
Share this answer
 
 
Share this answer
 
You could try web workers: https://developer.mozilla.org/en/docs/Web/Guide/Performance/Using_web_workers[^] - I've never used them myself, but they might be what you are looking for.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900