There are two different synchronous concepts here. First, "will he stop my entire web page and sit down and wait for the file."
The answer is no. RequireJS does not do this if you have a dependency script.
If you use it properly, it uses a promise system. This means that if you send your callback and define your requirements for this file, the callback will not be executed until all the necessary files have been downloaded.
If a requirement is required in one of these required files, then the THAT callback will not start until the ITS dependencies are loaded.
The most external callback (the one that would be at the bottom of your script, usually) will not work until everything inside is.
It works on a promise system. It is worth understanding how the promise systems work (similar to the observer pattern, in some way). They should be handed down or fettered, based on the event, instead of several people listening in any order.
var widget = new Widget(), widgetLoaded = widget.load(url); // return a promise to let the program use the widget widgetLoaded.then(function () { widget.move(35); }) .then(function () { widget.setColour("Blue"); }) .then(function () { widget.show(); });
This is similar to returning this so that you can catch function calls, except that the calls are not actually made until widget.load() completes.
widget will actually control when this happens, keeping its promise if the widget loads, and everything will be in order, or breaking its promise if something goes wrong.
In most promise systems .then or as they call it, either performs two functions (saved and broken - on my systems, brokers are always optional), or they take an object with success and failure - $.ajax does this and then allows it in advance determine what you want to do with the data at startup or if it fails - promises.
Thus, your page still works 100% asynchronously (without interrupting the user interface), but 100% synchronously so that all modules will work in the correct order.
One thing you SHOULD REMEMBER : If you have these dependencies in your code, you cannot have any dependencies at the bottom of your script, which is waiting to be run, built-in. All of them must be blocked inside your callback or locked inside a function that is waiting for a call on your callback.
It’s just because - This is an asynchronous process from the point of view of actual processing and does not block the launch of events / JS by the browser, page display, etc.