<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: LABjs: new hotness for script loading</title>
	<atom:link href="http://blog.getify.com/2009/11/labjs-new-hotness-for-script-loading/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.getify.com/2009/11/labjs-new-hotness-for-script-loading/</link>
	<description>open-source, javascript &#38; ui musings</description>
	<lastBuildDate>Mon, 22 Feb 2010 23:25:10 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Diego Perini</title>
		<link>http://blog.getify.com/2009/11/labjs-new-hotness-for-script-loading/comment-page-1/#comment-28</link>
		<dc:creator>Diego Perini</dc:creator>
		<pubDate>Tue, 01 Dec 2009 18:47:33 +0000</pubDate>
		<guid isPermaLink="false">http://blog.getify.com/?p=69#comment-28</guid>
		<description>Kyle,
I am really impressed by the work you did and the gains in the graphs.

I had an &#039;iframe&#039; parallel loading implementation but it&#039;s not working for the damn IE, so not usable on more than the 60% of browsers around ;-)

Your solution is quite appealing since it seems easy to implement on most sites and working cross-browser. My compliments.</description>
		<content:encoded><![CDATA[<p>Kyle,<br />
I am really impressed by the work you did and the gains in the graphs.</p>
<p>I had an &#8216;iframe&#8217; parallel loading implementation but it&#8217;s not working for the damn IE, so not usable on more than the 60% of browsers around <img src='http://getiblog.2static.it/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Your solution is quite appealing since it seems easy to implement on most sites and working cross-browser. My compliments.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: getify</title>
		<link>http://blog.getify.com/2009/11/labjs-new-hotness-for-script-loading/comment-page-1/#comment-20</link>
		<dc:creator>getify</dc:creator>
		<pubDate>Tue, 01 Dec 2009 00:48:45 +0000</pubDate>
		<guid isPermaLink="false">http://blog.getify.com/?p=69#comment-20</guid>
		<description>Thx, Steve! You certainly deserve a lot of credit for helping get 1.0 so much better at loading in parallel! :)</description>
		<content:encoded><![CDATA[<p>Thx, Steve! You certainly deserve a lot of credit for helping get 1.0 so much better at loading in parallel! <img src='http://getiblog.2static.it/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: souders</title>
		<link>http://blog.getify.com/2009/11/labjs-new-hotness-for-script-loading/comment-page-1/#comment-17</link>
		<dc:creator>souders</dc:creator>
		<pubDate>Mon, 30 Nov 2009 16:51:18 +0000</pubDate>
		<guid isPermaLink="false">http://blog.getify.com/?p=69#comment-17</guid>
		<description>Great work, Kyle. The three waterfall charts really highlight the benefits. Newer browsers (IE8, Safari4, FF3.5, and Chrome2) all load scripts in parallel, but as Kyle noted other resources (images, etc.) get blocked. And don&#039;t forget IE6&amp;7 don&#039;t have any parallel script loading. LABjs&#039; ability to load &lt;b&gt;ALL&lt;/b&gt; resources in parallel can greatly accelerate web pages.</description>
		<content:encoded><![CDATA[<p>Great work, Kyle. The three waterfall charts really highlight the benefits. Newer browsers (IE8, Safari4, FF3.5, and Chrome2) all load scripts in parallel, but as Kyle noted other resources (images, etc.) get blocked. And don&#8217;t forget IE6&amp;7 don&#8217;t have any parallel script loading. LABjs&#8217; ability to load <b>ALL</b> resources in parallel can greatly accelerate web pages.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: getify</title>
		<link>http://blog.getify.com/2009/11/labjs-new-hotness-for-script-loading/comment-page-1/#comment-16</link>
		<dc:creator>getify</dc:creator>
		<pubDate>Mon, 30 Nov 2009 14:26:37 +0000</pubDate>
		<guid isPermaLink="false">http://blog.getify.com/?p=69#comment-16</guid>
		<description>@jasonkarns -- it&#039;s a good idea, i agree. the problem is in reliably detecting that a script has failed to load. LABjs can&#039;t do so in a script-agnostic way, there&#039;d have to be special test functions tailored to the script that was trying to be loaded.

we&#039;d have to let the user be able to specify some sort of &quot;test&quot; function for a script, which if it fails (with a try/catch), then it assumes the script failed and so it moves on to the next fallback.

i explored the idea in LABjs but came to the conclusion that it was a corner case that would increase the size and complexity of LABjs more than the benefit, at least in terms of having it in the core library that is included on every site, as only some people would feel that was a necessary functionality.

However, I *do* feel like this is a perfect example of something that should be an &quot;add-on&quot; to LABjs. In the same way that I did &lt;a href=&quot;http://github.com/getify/LABjs/blob/master/fLAB.src.js&quot; rel=&quot;nofollow&quot;&gt;fLABjs&lt;/a&gt; as an adapter add-on for file:/// usage of LABjs (local filesystem loading for development environments), this same type of thing could be layered on top of LABjs actually quite easily.

I have wanted to build core functionality into LABjs that can be used as the nuts and bolts of larger more complex dependency systems and things. This would be a perfect test case for that kind of concept. Basically, you could create a simple wrapper to LABjs that does exactly what you&#039;re suggesting... it might look something like this:

&lt;pre style=&quot;background:#ccc;&quot;&gt;
function loadOrFallback(scripts,idx) {
   if (idx == null) idx = 0;
   $LAB.script(scripts[i].src).wait(function(){
      try { scripts[idx].test(); } catch(err) {
         if (idx &lt; scripts.length-1) loadOrFallback(scripts,idx+1);
      }
   });
}

function test_jQuery() { jQuery(&quot;&quot;); }

loadOrFallback([
{src:&quot;http://some.tld/framework.js&quot;,test:test_jQuery},
{src:&quot;http://another.tld/framework.js&quot;,test:test_jQuery},
{src:&quot;framework.js&quot;,test:test_jQuery}
]);
&lt;/pre&gt;

The &quot;loadOrFallback&quot; function tries the first script passed in, and then does a wait() function which runs the &quot;test&quot; function you pass in once that script either loads or fails. if the try/catch of the &quot;test&quot; function throws an error, a recursion back into &quot;loadOrFallback&quot; is done, with the next index of the scripts to load/test. So, this should cascade through the scripts you pass in, trying to load each one, one at a time, and test if it loaded correctly. If not, it should try the next one.

You could do a simple function like that, or you could write a wrapper similar to fLABjs that gives a chaining API compatible with (but augmented) LABjs, and then load both core LABjs and then this other wrapper on top of it.

If I experiment with the full wrapper option and get something tangible, I&#039;ll obviously do a blog post about it, so keep an eye out.</description>
		<content:encoded><![CDATA[<p>@jasonkarns &#8212; it&#8217;s a good idea, i agree. the problem is in reliably detecting that a script has failed to load. LABjs can&#8217;t do so in a script-agnostic way, there&#8217;d have to be special test functions tailored to the script that was trying to be loaded.</p>
<p>we&#8217;d have to let the user be able to specify some sort of &#8220;test&#8221; function for a script, which if it fails (with a try/catch), then it assumes the script failed and so it moves on to the next fallback.</p>
<p>i explored the idea in LABjs but came to the conclusion that it was a corner case that would increase the size and complexity of LABjs more than the benefit, at least in terms of having it in the core library that is included on every site, as only some people would feel that was a necessary functionality.</p>
<p>However, I *do* feel like this is a perfect example of something that should be an &#8220;add-on&#8221; to LABjs. In the same way that I did <a href="http://github.com/getify/LABjs/blob/master/fLAB.src.js" rel="nofollow">fLABjs</a> as an adapter add-on for file:/// usage of LABjs (local filesystem loading for development environments), this same type of thing could be layered on top of LABjs actually quite easily.</p>
<p>I have wanted to build core functionality into LABjs that can be used as the nuts and bolts of larger more complex dependency systems and things. This would be a perfect test case for that kind of concept. Basically, you could create a simple wrapper to LABjs that does exactly what you&#8217;re suggesting&#8230; it might look something like this:</p>
<pre style="background:#ccc;">
function loadOrFallback(scripts,idx) {
   if (idx == null) idx = 0;
   $LAB.script(scripts[i].src).wait(function(){
      try { scripts[idx].test(); } catch(err) {
         if (idx < scripts.length-1) loadOrFallback(scripts,idx+1);
      }
   });
}

function test_jQuery() { jQuery(""); }

loadOrFallback([
{src:"http://some.tld/framework.js",test:test_jQuery},
{src:"http://another.tld/framework.js",test:test_jQuery},
{src:"framework.js",test:test_jQuery}
]);
</pre>
<p>The "loadOrFallback" function tries the first script passed in, and then does a wait() function which runs the "test" function you pass in once that script either loads or fails. if the try/catch of the "test" function throws an error, a recursion back into "loadOrFallback" is done, with the next index of the scripts to load/test. So, this should cascade through the scripts you pass in, trying to load each one, one at a time, and test if it loaded correctly. If not, it should try the next one.</p>
<p>You could do a simple function like that, or you could write a wrapper similar to fLABjs that gives a chaining API compatible with (but augmented) LABjs, and then load both core LABjs and then this other wrapper on top of it.</p>
<p>If I experiment with the full wrapper option and get something tangible, I'll obviously do a blog post about it, so keep an eye out.</pre>
]]></content:encoded>
	</item>
	<item>
		<title>By: jasonkarns</title>
		<link>http://blog.getify.com/2009/11/labjs-new-hotness-for-script-loading/comment-page-1/#comment-13</link>
		<dc:creator>jasonkarns</dc:creator>
		<pubDate>Mon, 30 Nov 2009 04:32:00 +0000</pubDate>
		<guid isPermaLink="false">http://blog.getify.com/?p=69#comment-13</guid>
		<description>Question/Suggestion: A thought I&#039;ve long had now that Google, Yahoo, and Microsoft all have Ajax CDN&#039;s, is using these CDN&#039;s in parallel and has fail-overs. This is something that would have to be handled by a loader of some sort. My thought is based on the concerns that many people have with using these CDN&#039;s. Primarily, what happens to my site when the CDN goes down? Granted, the chance of Google&#039;s CDN going down is very low, but there is still some additional risk in using a third party to serve critical content (like JS libraries). My thought is to configure a loader to attempt to download a script from additional locations if/when the original reference fails to load (receives an HTTP error) or times out. I think this functionality would be a great benefit to LABjs if one were able to specify a number of fallback locations for a specific script so I could do something along the lines of:
$LAB
.script(&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;)
.fallback(&quot;http://ajax.microsoft.com/ajax/jquery/jquery-1.3.2.min.js&quot;)
.fallback(&quot;jquery-1.3.2.min.js&quot;)

Thoughts?</description>
		<content:encoded><![CDATA[<p>Question/Suggestion: A thought I&#8217;ve long had now that Google, Yahoo, and Microsoft all have Ajax CDN&#8217;s, is using these CDN&#8217;s in parallel and has fail-overs. This is something that would have to be handled by a loader of some sort. My thought is based on the concerns that many people have with using these CDN&#8217;s. Primarily, what happens to my site when the CDN goes down? Granted, the chance of Google&#8217;s CDN going down is very low, but there is still some additional risk in using a third party to serve critical content (like JS libraries). My thought is to configure a loader to attempt to download a script from additional locations if/when the original reference fails to load (receives an HTTP error) or times out. I think this functionality would be a great benefit to LABjs if one were able to specify a number of fallback locations for a specific script so I could do something along the lines of:<br />
$LAB<br />
.script(&#8220;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&#8221;)<br />
.fallback(&#8220;http://ajax.microsoft.com/ajax/jquery/jquery-1.3.2.min.js&#8221;)<br />
.fallback(&#8220;jquery-1.3.2.min.js&#8221;)</p>
<p>Thoughts?</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- This site's performance optimized by W3 Total Cache. Dramatically improve the speed and reliability of your blog!

Learn more about our WordPress Plugins: http://www.w3-edge.com/wordpress-plugins/

Content Delivery Network via getiblog.2static.it

Served from: shade.ayame @ 2010-03-11 03:57:16 -->