Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I believe by default most browsers today will actually load the scripts in parallel; but the browser will not by default execute the scripts in parallel. For example, in the following code the scripts will be loaded in parallel. In the image we can see that Fast1.js and Fast2.js loads extremely fast, but based on the time in the browser console, Fast2.js executes 3 seconds after Fast1.js executes. </p> <p>Also, something else to keep in mind is that the order of the files can make a difference. The Backbone.js file depends on the underscore.js file. If we changed the order of these files, where bacbone.js is before underscore.js, an error will be raised.</p> <pre><code>&lt;html &gt; &lt;head&gt; &lt;title&gt;&lt;/title&gt; &lt;script src="scripts/fast1.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="scripts/libs/jquery-1.8.3.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="scripts/libs/underscore.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="scripts/libs/backbone.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="scripts/fast2.js" type="text/javascript"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; Hello &lt;script type="text/javascript"&gt; console.log("html: " + Date()); &lt;/script&gt; &lt;img src="imgs/bImg.png" /&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Here's the code for the JavaScript file Fast1.js and Fast2.js</p> <pre><code>console.log("Fast 1: " + Date()) </code></pre> <p><img src="https://i.stack.imgur.com/00n6D.png" alt="Script file loading in browser"></p> <p>For Script loading I use Require.js. It also provides the benefit of organizing your code into modules that are in individual files.</p> <p>Here's an a blog post I create on Browser Script Loading: <a href="http://bardevblog.wordpress.com/2013/01/03/browser-script-loading/" rel="noreferrer">Browser Script Loading</a></p> <p>Here are a few articles on Script loading:</p> <ul> <li><a href="http://www.stevesouders.com/blog/2010/12/06/evolution-of-script-loading/" rel="noreferrer">Script Loading</a> </li> <li><a href="http://www.stevesouders.com/blog/2010/02/07/browser-script-loading-roundup/" rel="noreferrer">Browser script loading roundup</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload