<?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: Delaying JavaScript Execution</title>
	<atom:link href="http://ajaxian.com/archives/delaying-javascript-execution/feed" rel="self" type="application/rss+xml" />
	<link>http://ajaxian.com/archives/delaying-javascript-execution</link>
	<description>Cleaning up the web with Ajax</description>
	<lastBuildDate>Thu, 09 Feb 2012 06:55:33 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
	<item>
		<title>By: unscriptable</title>
		<link>http://ajaxian.com/archives/delaying-javascript-execution/comment-page-1#comment-272226</link>
		<dc:creator>unscriptable</dc:creator>
		<pubDate>Fri, 20 Mar 2009 17:29:36 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=4901#comment-272226</guid>
		<description>I just finished a blog post on this, but just stumbled on this now.  

Strictly speaking, this is &quot;debouncing&quot;, not &quot;throttling&quot;.  Throttling is a technique that changes the rate of the event signaling.  Debouncing ensures that only one event signal in a series of events goes through.

For a much more reusable version of a debounce method, go to (shameless plug):
http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/</description>
		<content:encoded><![CDATA[<p>I just finished a blog post on this, but just stumbled on this now.  </p>
<p>Strictly speaking, this is &#8220;debouncing&#8221;, not &#8220;throttling&#8221;.  Throttling is a technique that changes the rate of the event signaling.  Debouncing ensures that only one event signal in a series of events goes through.</p>
<p>For a much more reusable version of a debounce method, go to (shameless plug):<br />
<a href="http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/" rel="nofollow">http://unscriptable.com/index.php/2009/03/20/debouncing-javascript-methods/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ashendw</title>
		<link>http://ajaxian.com/archives/delaying-javascript-execution/comment-page-1#comment-268498</link>
		<dc:creator>ashendw</dc:creator>
		<pubDate>Wed, 29 Oct 2008 00:28:07 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=4901#comment-268498</guid>
		<description>Re delayed code loading, I have in past teamed delays with dojotookit&#039;s &quot;dojo.require&quot;

The page loads and I load up the core code for the main menus etc. Once drawn I pause for a moment and then use dojo.require to bring in code that will be used elsewhere.  dojo.require can be placed in a function and can load code at any time so you need only have something such as:

window.setTimeout(function(){
dojo.require(&quot;something.blah&quot;);
}, 3000);

The pause can make the UI feel stable and complete before quietly commencing background code loading.</description>
		<content:encoded><![CDATA[<p>Re delayed code loading, I have in past teamed delays with dojotookit&#8217;s &#8220;dojo.require&#8221;</p>
<p>The page loads and I load up the core code for the main menus etc. Once drawn I pause for a moment and then use dojo.require to bring in code that will be used elsewhere.  dojo.require can be placed in a function and can load code at any time so you need only have something such as:</p>
<p>window.setTimeout(function(){<br />
dojo.require(&#8220;something.blah&#8221;);<br />
}, 3000);</p>
<p>The pause can make the UI feel stable and complete before quietly commencing background code loading.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Malde</title>
		<link>http://ajaxian.com/archives/delaying-javascript-execution/comment-page-1#comment-268496</link>
		<dc:creator>Malde</dc:creator>
		<pubDate>Tue, 28 Oct 2008 21:39:37 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=4901#comment-268496</guid>
		<description>I often use this technique to do redrawing when neccessary but only after all current code has been executed. Methods in a complex object system signal that they need a redraw but only the last redraw will actually do anything. In this case it makes sense to set the delay to 0.

In general it makes sense to really grok JS&#039;s execution model when doing serious AJAX development. We recents used this technique to implement a unit testing framework that waits for tests that execute asynchronously if neccessary.</description>
		<content:encoded><![CDATA[<p>I often use this technique to do redrawing when neccessary but only after all current code has been executed. Methods in a complex object system signal that they need a redraw but only the last redraw will actually do anything. In this case it makes sense to set the delay to 0.</p>
<p>In general it makes sense to really grok JS&#8217;s execution model when doing serious AJAX development. We recents used this technique to implement a unit testing framework that waits for tests that execute asynchronously if neccessary.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Michael Mahemoff</title>
		<link>http://ajaxian.com/archives/delaying-javascript-execution/comment-page-1#comment-268487</link>
		<dc:creator>Michael Mahemoff</dc:creator>
		<pubDate>Tue, 28 Oct 2008 17:56:19 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=4901#comment-268487</guid>
		<description>It&#039;s called Submission Throttling in Ajax Design Patterns ( http://ajaxpatterns.org/Submission_Throttling ). It&#039;s a special case of this general pattern...in this special case it&#039;s intended for throttling calls to the server. In any event, the essence of the idiom/pattern is:

(1) Delay code execution after an event
(2) If a new event occurs while waiting, clear the timer and start waiting all over again

It is (2) that makes this more than just setTimeout.

There&#039;s a demo of this in action here:
http://ajaxify.com/tutorial/ajaxagram/ajaxified/richer/performant/
You&#039;ll notice if you keep hitting keys, it will never actually do anything. It&#039;s only when you give it a break that it fires off the request. Interestingly, the app becomes more user-friendly AND more performant/scaleable, and in only 3 lines of code refactoring. (Transitioning it from an onkeypress handler to a timer mechanism.)

It&#039;s used as an Ajax tutorial in the book and there&#039;s some explanation here, under &quot;Streamlining Performance&quot;:
http://ajaxify.com/tutorial/</description>
		<content:encoded><![CDATA[<p>It&#8217;s called Submission Throttling in Ajax Design Patterns ( <a href="http://ajaxpatterns.org/Submission_Throttling" rel="nofollow">http://ajaxpatterns.org/Submission_Throttling</a> ). It&#8217;s a special case of this general pattern&#8230;in this special case it&#8217;s intended for throttling calls to the server. In any event, the essence of the idiom/pattern is:</p>
<p>(1) Delay code execution after an event<br />
(2) If a new event occurs while waiting, clear the timer and start waiting all over again</p>
<p>It is (2) that makes this more than just setTimeout.</p>
<p>There&#8217;s a demo of this in action here:<br />
<a href="http://ajaxify.com/tutorial/ajaxagram/ajaxified/richer/performant/" rel="nofollow">http://ajaxify.com/tutorial/ajaxagram/ajaxified/richer/performant/</a><br />
You&#8217;ll notice if you keep hitting keys, it will never actually do anything. It&#8217;s only when you give it a break that it fires off the request. Interestingly, the app becomes more user-friendly AND more performant/scaleable, and in only 3 lines of code refactoring. (Transitioning it from an onkeypress handler to a timer mechanism.)</p>
<p>It&#8217;s used as an Ajax tutorial in the book and there&#8217;s some explanation here, under &#8220;Streamlining Performance&#8221;:<br />
<a href="http://ajaxify.com/tutorial/" rel="nofollow">http://ajaxify.com/tutorial/</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mmurph211</title>
		<link>http://ajaxian.com/archives/delaying-javascript-execution/comment-page-1#comment-268485</link>
		<dc:creator>mmurph211</dc:creator>
		<pubDate>Tue, 28 Oct 2008 17:54:43 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=4901#comment-268485</guid>
		<description>@MichaelThompson -
The blog post is actually titled &quot;Delaying Javascript Event Execution&quot; not simply delaying any sort of javascript code execution. As Schill pointed out, it&#039;s mainly used as a throttle for IE&#039;s resize, scroll, etc events that fire often.
@Schill -
Thanks for pointing out Nick Zakas&#039; post, had not seen it before. It&#039;s certainly a pattern developer&#039;s should have in their solutions arsenal.</description>
		<content:encoded><![CDATA[<p>@MichaelThompson -<br />
The blog post is actually titled &#8220;Delaying Javascript Event Execution&#8221; not simply delaying any sort of javascript code execution. As Schill pointed out, it&#8217;s mainly used as a throttle for IE&#8217;s resize, scroll, etc events that fire often.<br />
@Schill -<br />
Thanks for pointing out Nick Zakas&#8217; post, had not seen it before. It&#8217;s certainly a pattern developer&#8217;s should have in their solutions arsenal.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Schill</title>
		<link>http://ajaxian.com/archives/delaying-javascript-execution/comment-page-1#comment-268478</link>
		<dc:creator>Schill</dc:creator>
		<pubDate>Tue, 28 Oct 2008 16:07:46 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=4901#comment-268478</guid>
		<description>I&#039;ve also seen this referred to as &quot;function throttling&quot; or &quot;event handler throttling&quot; - names aside, it&#039;s a good (and in JS-land, sometimes important) pattern to have handy for event handlers in particular.
&#160;
As for event handling, as one example, IE fires tons of resize()-related window events during a window drag-resize vs. Firefox which fires only one when the mouse stops moving (or on release of the mouse, I forget).. So reducing expensive calls can be useful. Nick Zakas and others (Heilmann I think) have &lt;a href=&quot;http://www.nczonline.net/blog/2007/11/30/the-throttle-function/&quot; rel=&quot;nofollow&quot;&gt;similar approaches&lt;/a&gt; themselves.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve also seen this referred to as &#8220;function throttling&#8221; or &#8220;event handler throttling&#8221; &#8211; names aside, it&#8217;s a good (and in JS-land, sometimes important) pattern to have handy for event handlers in particular.<br />
&nbsp;<br />
As for event handling, as one example, IE fires tons of resize()-related window events during a window drag-resize vs. Firefox which fires only one when the mouse stops moving (or on release of the mouse, I forget).. So reducing expensive calls can be useful. Nick Zakas and others (Heilmann I think) have <a href="http://www.nczonline.net/blog/2007/11/30/the-throttle-function/" rel="nofollow">similar approaches</a> themselves.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: MichaelThompson</title>
		<link>http://ajaxian.com/archives/delaying-javascript-execution/comment-page-1#comment-268476</link>
		<dc:creator>MichaelThompson</dc:creator>
		<pubDate>Tue, 28 Oct 2008 15:59:41 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=4901#comment-268476</guid>
		<description>Wow. Using setTimeout to delay code. That&#039;s what it&#039;s for. How is this newsworthy all of a sudden?</description>
		<content:encoded><![CDATA[<p>Wow. Using setTimeout to delay code. That&#8217;s what it&#8217;s for. How is this newsworthy all of a sudden?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ilazarte</title>
		<link>http://ajaxian.com/archives/delaying-javascript-execution/comment-page-1#comment-268471</link>
		<dc:creator>ilazarte</dc:creator>
		<pubDate>Tue, 28 Oct 2008 15:06:20 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=4901#comment-268471</guid>
		<description>Shameless plug: I made something similar in Jquery plugin form a while ago except it lets you pass in a function making all of it easier :)  Plus it&#039;s JQuery so it automatically kicks ass.

http://ihatecode.blogspot.com/2008/04/jquery-time-delay-event-binding-plugin.html</description>
		<content:encoded><![CDATA[<p>Shameless plug: I made something similar in Jquery plugin form a while ago except it lets you pass in a function making all of it easier :)  Plus it&#8217;s JQuery so it automatically kicks ass.</p>
<p><a href="http://ihatecode.blogspot.com/2008/04/jquery-time-delay-event-binding-plugin.html" rel="nofollow">http://ihatecode.blogspot.com/2008/04/jquery-time-delay-event-binding-plugin.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tavs</title>
		<link>http://ajaxian.com/archives/delaying-javascript-execution/comment-page-1#comment-268465</link>
		<dc:creator>Tavs</dc:creator>
		<pubDate>Tue, 28 Oct 2008 13:34:43 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=4901#comment-268465</guid>
		<description>Or as a method of the function object: http://www.jslab.dk/library/Function.defer</description>
		<content:encoded><![CDATA[<p>Or as a method of the function object: <a href="http://www.jslab.dk/library/Function.defer" rel="nofollow">http://www.jslab.dk/library/Function.defer</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: insicdesigns</title>
		<link>http://ajaxian.com/archives/delaying-javascript-execution/comment-page-1#comment-268460</link>
		<dc:creator>insicdesigns</dc:creator>
		<pubDate>Tue, 28 Oct 2008 12:29:21 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=4901#comment-268460</guid>
		<description>this code is very usefull in lot of ways. thanks for this.</description>
		<content:encoded><![CDATA[<p>this code is very usefull in lot of ways. thanks for this.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

