Comments on: Non-blocking JavaScript Downloads http://yuiblog.com/blog/2008/07/22/non-blocking-scripts/ News and Artilces about Designing and Developing with Yahoo! Libraries. Fri, 05 Dec 2008 08:04:42 +0000 http://wordpress.org/?v=2.3.3 By: Stoyan http://yuiblog.com/blog/2008/07/22/non-blocking-scripts/#comment-511215 Stoyan Mon, 10 Nov 2008 16:28:26 +0000 http://yuiblog.com/blog/2008/07/22/non-blocking-scripts/#comment-511215 Hi Russell, it's the YUI GET utility that's doing the loop, you only need to call it passing an array: <code>YAHOO.util.Get.script(urls);</code> Here <code>urls</code> is an array. You may be confused by the bracket notation used to define an array in JavaScript (called "array literal notation"). This: <code>var myarray = [1,2,3,4];</code> is the same as: <code> var myarray = new Array(); myarray[0] = 1; //... myarray[3] = 4; </code> Hi Russell, it’s the YUI GET utility that’s doing the loop, you only need to call it passing an array:

YAHOO.util.Get.script(urls);

Here urls is an array. You may be confused by the bracket notation used to define an array in JavaScript (called “array literal notation”).

This:
var myarray = [1,2,3,4];
is the same as:

var myarray = new Array();
myarray[0] = 1;
//...
myarray[3] = 4;

]]>
By: russell http://yuiblog.com/blog/2008/07/22/non-blocking-scripts/#comment-510320 russell Sat, 08 Nov 2008 14:47:18 +0000 http://yuiblog.com/blog/2008/07/22/non-blocking-scripts/#comment-510320 Stoyan, I noticed the code on the 2nd example having some kind of loop. My javascript knowledge is tiny - is this some kind of way of loading multiple js files that's not covered above? It almost looks like it could loop through a few js files... Stoyan, I noticed the code on the 2nd example having some kind of loop. My javascript knowledge is tiny - is this some kind of way of loading multiple js files that’s not covered above? It almost looks like it could loop through a few js files…

]]>
By: Free Chapter: “Coding and Design Patterns” from Stoyan Stefanov’s Object-Oriented JavaScript » Yahoo! User Interface Blog http://yuiblog.com/blog/2008/07/22/non-blocking-scripts/#comment-478850 Free Chapter: “Coding and Design Patterns” from Stoyan Stefanov’s Object-Oriented JavaScript » Yahoo! User Interface Blog Fri, 26 Sep 2008 15:30:06 +0000 http://yuiblog.com/blog/2008/07/22/non-blocking-scripts/#comment-478850 [...] Stoyan Stefanov is a member of Yahoo’s Exceptional Performance team; he’s worked on a variety of performance-related projects at Yahoo, including the popular YSlow plugin for Firebug. He’s also a contributing author here on YUIBlog. [...] […] Stoyan Stefanov is a member of Yahoo’s Exceptional Performance team; he’s worked on a variety of performance-related projects at Yahoo, including the popular YSlow plugin for Firebug. He’s also a contributing author here on YUIBlog. […]

]]>
By: sherita http://yuiblog.com/blog/2008/07/22/non-blocking-scripts/#comment-439565 sherita Thu, 07 Aug 2008 20:35:02 +0000 http://yuiblog.com/blog/2008/07/22/non-blocking-scripts/#comment-439565 how do i install javascript on my computer how do i install javascript on my computer

]]>
By: speeding up page loads « null pointers … http://yuiblog.com/blog/2008/07/22/non-blocking-scripts/#comment-439262 speeding up page loads « null pointers … Thu, 07 Aug 2008 08:51:53 +0000 http://yuiblog.com/blog/2008/07/22/non-blocking-scripts/#comment-439262 [...] http://yuiblog.com/blog/2008/07/22/non-blocking-scripts/ [...] […] http://yuiblog.com/blog/2008/07/22/non-blocking-scripts/ […]

]]>
By: mike river http://yuiblog.com/blog/2008/07/22/non-blocking-scripts/#comment-438854 mike river Wed, 06 Aug 2008 20:24:50 +0000 http://yuiblog.com/blog/2008/07/22/non-blocking-scripts/#comment-438854 Take it to the extreme!!! Load an empty html, start imediately loading js (break it in several files), css AND the remaining html, all in parallel ( you can load more than 2 in parallel, using subdomains, the limit is 2/url, studies show that optimal is 4(subdomains)x2 ). Take it to the extreme!!! Load an empty html, start imediately loading js (break it in several files), css AND the remaining html, all in parallel ( you can load more than 2 in parallel, using subdomains, the limit is 2/url, studies show that optimal is 4(subdomains)x2 ).

]]>
By: Performance web » Javascript non bloquant http://yuiblog.com/blog/2008/07/22/non-blocking-scripts/#comment-437040 Performance web » Javascript non bloquant Mon, 04 Aug 2008 10:01:23 +0000 http://yuiblog.com/blog/2008/07/22/non-blocking-scripts/#comment-437040 [...] Stefanov en parle lui aussi, en [...] […] Stefanov en parle lui aussi, en […]

]]>
By: Pingu http://yuiblog.com/blog/2008/07/22/non-blocking-scripts/#comment-433669 Pingu Thu, 31 Jul 2008 12:47:38 +0000 http://yuiblog.com/blog/2008/07/22/non-blocking-scripts/#comment-433669 Nicely presented but definately not the first time I've seen this technique.... Lots of JS libraries have similar functionality, some for several years now. With all due respect perhaps you should check for existing solutions first and then spend your free time fixing problems that have no good solution as yet? Nicely presented but definately not the first time I’ve seen this technique…. Lots of JS libraries have similar functionality, some for several years now.

With all due respect perhaps you should check for existing solutions first and then spend your free time fixing problems that have no good solution as yet?

]]>
By: Stefan Hayden » Javascript Event onJSReady Fires When All JS Files Have Loaded http://yuiblog.com/blog/2008/07/22/non-blocking-scripts/#comment-432140 Stefan Hayden » Javascript Event onJSReady Fires When All JS Files Have Loaded Tue, 29 Jul 2008 15:57:47 +0000 http://yuiblog.com/blog/2008/07/22/non-blocking-scripts/#comment-432140 [...] the YUI blog had a great post on how javascript blocks downloads and makes the page take longer to load. This is because any JS file can modify the DOM and so the [...] […] the YUI blog had a great post on how javascript blocks downloads and makes the page take longer to load. This is because any JS file can modify the DOM and so the […]

]]>
By: Stoyan http://yuiblog.com/blog/2008/07/22/non-blocking-scripts/#comment-431221 Stoyan Mon, 28 Jul 2008 17:22:03 +0000 http://yuiblog.com/blog/2008/07/22/non-blocking-scripts/#comment-431221 Simon, Andrew, what I meant about defer is that using this attribute is not a guarantee that the script will wait, it depends on what other components are on the page. I've <a href="http://www.phpied.com/deferring-scripts-for-faster-rendering/" rel="nofollow">experimented</a> in the past and found that for example if you have a non-deferred script that's taking a while, the deferred might be executed meanwhile. Simon, Andrew, what I meant about defer is that using this attribute is not a guarantee that the script will wait, it depends on what other components are on the page. I’ve experimented in the past and found that for example if you have a non-deferred script that’s taking a while, the deferred might be executed meanwhile.

]]>