0

If I use $.getScript without callback (or async/await syntax etc.) just like this:

let data = $.getScript("...");

Does it block only the current script, or blocks main event loop and all scripts in page have to wait until download this data?

1 Answer 1

3

None of the above. :-) getScript starts an asynchronous operation. It doesn't block, other than very briefly to start the operation, regardless of whether you provide a callback. While the operation is running, the main UI thread is free to run tasks from other script code on the page, and the browser is free to download other scripts and execute them.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.