<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="http://www.bytemycode.com/rssformat.xsl"?><rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/">
	<channel>
		<title>byteMyCode: Snippet Revisions</title>
		<link>http://www.bytemycode.com</link>
		<description>Revisions for this snippet.</description>
		<pubDate>Sat, 11 Oct 2008 00:09:33 +0000</pubDate>
		<copyright>1998-2008 </copyright>
		<language>en-us</language>
		<image>
		      <link>http://www.bytemycode.com</link>
		      <url>http://www.bytemycode.com/img/rss_title.gif</url>
		      <title>byteMyCode</title>
		</image>

	
	<item>
		<title>Function.prototype.promise 1</title>
		<link>http://www.bytemycode.com/snippets/snippet/779/1/</link>
		<comments>http://www.bytemycode.com/snippets/snippet/779/comments/</comments>
		<pubDate>Thu, 20 Dec 2007 18:48:52 +0000</pubDate>
		<dc:creator>Fordiman</dc:creator>
		<category>JavaScript, promise, Prototype</category>
		<guid isPermaLink="false">http://www.bytemycode.com/snippets/snippet/779/</guid>
		<description>
			<![CDATA[
				<p>This is a version of my previous entrant, Promise, that will work with prototype, but does not require it.  It's slightly more advanced, using .apply here and there.<br /><br />It's basically a function to allow any other function to poll.  Polling is generally regarded as bad practice in object oriented code, but can make very simple the matter of, for example, running a bit of code only after a single-run event (like onload) occurs (whether that be in the future or past), another unrelated bit of code needs to be hack-tracked, or any other generic condition.<br /><br />Note that when the function runs, it doesn't necessarily run within the scope that's called it.  Its context is set to itself, rather than its normal context, and it's asynchronous, so you'll not get a return value.  If you use Prototype, you can bind the function and it'll behave as it should in terms of context, but I'm unaware of a way to cause an asynch function to block execution - and you'd really rather that not happen anyway, trust me.</p>
			]]>
		</description>
	</item>

	
	</channel>
</rss>