Does the jQuery.ajax({async: false})object use XMLHttpRequest?
If so, how is the request synchronous?
Is there any mechanism inside the function definition that allows you to wrap an asynchronous request sent by XHR in a synchronous shell?
I ask because I want to wrap asynchronous function calls in a synchronous wrapper.
EDIT
I want to do this for dependencies. I do not need to run anything until all external dependency scripts load, however I would prefer not to load each file synchronously.
Basically, I want this:
require(['lib1.js','lib2.js'])
Library1Function();
Library2Function();
Load lib1 and lib2 at the same time, but block until both are loaded.
, , , , , , .
EDITx2
, :
window.Library2Function = function(input) {
alert(input);
}
require('lib2.js', function() {
window.Library1Function = function() {
window.Library2Function('Hi there');
}
});
require('lib1.js', function() {
window.Library1Function();
});
, main.js lib1.js.
, Library2Function lib2.js, lib1.js.