I want to set a JS function running, but not wait for the response. The only way I can think to do it is:
setTimeout(function() {
myFunc();
},0);
But that seems… inefficient at best. Any ideas?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Why is that inefficient?
Also, don’t forget that browser javascript is single-threaded. So, while your function runs, you will implicitly wait for it to return.
(async ajax calls may be an exception here)