io.js.html revision eb9b6f817df5c660be9f00fc5d27fe33479fdc98
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<title>API: io io.js (YUI Library)</title>
<link rel="stylesheet" type="text/css" href="assets/api.css">
<script type="text/javascript" src="assets/api-js"></script>
<script type="text/javascript" src="assets/ac-js"></script>
</head>
<body id="yahoo-com">
<div id="doc3" class="yui-t2">
<div id="hd">
<a href="http://developer.yahoo.com/yui/"><h1>Yahoo! UI Library</h1></a>
<h3>io&nbsp; <span class="subtitle">3.00PR1</span></h3>
<p>
<a href="/index.html">Yahoo! UI Library</a>
&gt; <a href="/module_io.html">io</a>
&gt; io.js (source view)
</p>
</div>
<div id="bd">
<div id="yui-main">
<div class="yui-b">
<form name="yui-classopts-form">
<span id="classopts"><input type="checkbox" name="showprivate" id="showprivate" /> Show Private</span>
<span id="classopts"><input type="checkbox" name="showprotected" id="showprotected" /> Show Protected</span>
<span id="classopts"><input type="checkbox" name="showdeprecated" id="showdeprecated" /> Show Deprecated</span>
</form>
<div id="srcout">
<style>
#doc3 #classopts { display:none; }
</style>
<div class="highlight" ><pre><span class="nx">YUI</span><span class="o">.</span><span class="nx">add</span><span class="o">(</span><span class="s2">&quot;io&quot;</span><span class="o">,</span> <span class="k">function</span> <span class="o">(</span><span class="nx">Y</span><span class="o">)</span> <span class="o">{</span>
<span class="c">/**</span>
<span class="c"> * HTTP communications module.</span>
<span class="c"> * @module io</span>
<span class="c"> */</span>
<span class="c">/**</span>
<span class="c"> * The io class is a utility that brokers HTTP requests through a simplified</span>
<span class="c"> * interface. Specifically, it allows JavaScript to make HTTP requests to</span>
<span class="c"> * a resource without a page reload. The underlying transport for making</span>
<span class="c"> * same-domain requests is the XMLHttpRequest object. YUI.io can also use</span>
<span class="c"> * Flash, if specified as a transport, for cross-domain requests.</span>
<span class="c"> *</span>
<span class="c"> * @class io</span>
<span class="c"> */</span>
<span class="c">/**</span>
<span class="c"> * @event io:xdrReady</span>
<span class="c"> * @description This event is fired by YUI.io when a transaction is initiated..</span>
<span class="c"> * @type Event Custom</span>
<span class="c"> */</span>
<span class="k">var</span> <span class="nx">E_XDR_READY</span> <span class="o">=</span> <span class="s1">&#39;io:xdrReady&#39;</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @event io:start</span>
<span class="c"> * @description This event is fired by YUI.io when a transaction is initiated..</span>
<span class="c"> * @type Event Custom</span>
<span class="c"> */</span>
<span class="nx">E_START</span> <span class="o">=</span> <span class="s1">&#39;io:start&#39;</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @event io:complete</span>
<span class="c"> * @description This event is fired by YUI.io when a transaction is complete and</span>
<span class="c"> * all response data are available.</span>
<span class="c"> * @type Event Custom</span>
<span class="c"> */</span>
<span class="nx">E_COMPLETE</span> <span class="o">=</span> <span class="s1">&#39;io:complete&#39;</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @event io:success</span>
<span class="c"> * @description This event is fired by YUI.io when a transaction is complete and</span>
<span class="c"> * the HTTP status resolves to HTTP2xx.</span>
<span class="c"> * @type Event Custom</span>
<span class="c"> */</span>
<span class="nx">E_SUCCESS</span> <span class="o">=</span> <span class="s1">&#39;io:success&#39;</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @event io:failure</span>
<span class="c"> * @description This event is fired by YUI.io when a transaction is complete and</span>
<span class="c"> * the HTTP status resolves to HTTP4xx, 5xx and above.</span>
<span class="c"> * @type Event Custom</span>
<span class="c"> */</span>
<span class="nx">E_FAILURE</span> <span class="o">=</span> <span class="s1">&#39;io:failure&#39;</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @event io:abort</span>
<span class="c"> * @description This event is fired by YUI.io when a transaction is aborted</span>
<span class="c"> * explicitly or by a defined config.timeout.</span>
<span class="c"> * @type Event Custom</span>
<span class="c"> */</span>
<span class="nx">E_ABORT</span> <span class="o">=</span> <span class="s1">&#39;io:abort&#39;</span><span class="o">,</span>
<span class="c">// Window reference</span>
<span class="c"></span> <span class="nx">w</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">config</span><span class="o">.</span><span class="nx">win</span><span class="o">,</span>
<span class="nx">d</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">config</span><span class="o">.</span><span class="nx">doc</span><span class="o">,</span>
<span class="c">//--------------------------------------</span>
<span class="c"></span> <span class="c">// Properties</span>
<span class="c"></span> <span class="c">//--------------------------------------</span>
<span class="c"></span> <span class="c">/**</span>
<span class="c"> * @description A transaction counter that increments for each transaction.</span>
<span class="c"> *</span>
<span class="c"> * @property transactionId</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @type int</span>
<span class="c"> */</span>
<span class="nx">transactionId</span> <span class="o">=</span> <span class="m">0</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @description Object of default HTTP headers to be initialized and sent</span>
<span class="c"> * for all transactions.</span>
<span class="c"> *</span>
<span class="c"> * @property _headers</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @type object</span>
<span class="c"> */</span>
<span class="nx">_headers</span> <span class="o">=</span> <span class="o">{</span>
<span class="s1">&#39;X-Requested-With&#39;</span> <span class="o">:</span> <span class="s1">&#39;XMLHttpRequest&#39;</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @description Object that stores timeout values for any transaction with</span>
<span class="c"> * a defined &quot;timeout&quot; configuration property.</span>
<span class="c"> *</span>
<span class="c"> * @property _timeOut</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @type object</span>
<span class="c"> */</span>
<span class="nx">_timeout</span> <span class="o">=</span> <span class="o">{},</span>
<span class="c">/**</span>
<span class="c"> * @description Object that stores callback handlers for cross-domain requests,</span>
<span class="c"> *</span>
<span class="c"> * @property _fn</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @type object</span>
<span class="c"> */</span>
<span class="nx">_fn</span> <span class="o">=</span> <span class="o">{},</span>
<span class="c">/**</span>
<span class="c"> * @description Map of transports created for cross-domain requests.</span>
<span class="c"> *</span>
<span class="c"> * @property _xdr</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @type object</span>
<span class="c"> */</span>
<span class="nx">_xdr</span> <span class="o">=</span> <span class="o">{</span>
<span class="nx">flash</span><span class="o">:</span><span class="kc">null</span>
<span class="o">},</span>
<span class="c">/**</span>
<span class="c"> * @description Array of transactions queued for processing</span>
<span class="c"> *</span>
<span class="c"> * @property _q</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @type array</span>
<span class="c"> */</span>
<span class="nx">_q</span> <span class="o">=</span> <span class="o">[],</span>
<span class="c">/**</span>
<span class="c"> * @description Property to determine whether the queue is set to</span>
<span class="c"> * 1 (active) or 0 (inactive). When inactive, transactions</span>
<span class="c"> * will be stored in the queue until the queue is set to active.</span>
<span class="c"> *</span>
<span class="c"> * @property _qState</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @type int</span>
<span class="c"> */</span>
<span class="nx">_qState</span> <span class="o">=</span> <span class="m">1</span><span class="o">,</span>
<span class="c">/**</span>
<span class="c"> * @description Queue property to set a maximum queue storage size. When</span>
<span class="c"> * this property is set, the queue will not store any more transactions</span>
<span class="c"> * until the queue size os reduced below this threshold. There is no</span>
<span class="c"> * maximum queue size until it is explicitly set.</span>
<span class="c"> *</span>
<span class="c"> * @property _qMaxSize</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @type int</span>
<span class="c"> */</span>
<span class="nx">_qMaxSize</span> <span class="o">=</span> <span class="kc">false</span><span class="o">;</span>
<span class="c">//--------------------------------------</span>
<span class="c"></span> <span class="c">// Methods</span>
<span class="c"></span> <span class="c">//--------------------------------------</span>
<span class="c"></span> <span class="c">/**</span>
<span class="c"> * @description Method for requesting a transaction, and queueing the</span>
<span class="c"> * request before it is sent to the resource.</span>
<span class="c"> *</span>
<span class="c"> * @method _queue</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @return int</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">_queue</span><span class="o">(</span><span class="nx">uri</span><span class="o">,</span> <span class="nx">c</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">_qMaxSize</span> <span class="o">===</span> <span class="kc">false</span> <span class="o">||</span> <span class="nx">_q</span><span class="o">.</span><span class="nx">length</span> <span class="o">&lt;</span> <span class="nx">_qMaxSize</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">id</span> <span class="o">=</span> <span class="nx">_id</span><span class="o">();</span>
<span class="nx">_q</span><span class="o">.</span><span class="nx">push</span><span class="o">({</span> <span class="nx">uri</span><span class="o">:</span> <span class="nx">uri</span><span class="o">,</span> <span class="nx">id</span><span class="o">:</span> <span class="nx">id</span><span class="o">,</span> <span class="nx">cfg</span><span class="o">:</span><span class="nx">c</span> <span class="o">});</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;Unable to queue transaction object. Maximum queue size reached.&#39;</span><span class="o">,</span> <span class="s1">&#39;warn&#39;</span><span class="o">,</span> <span class="s1">&#39;io&#39;</span><span class="o">);</span>
<span class="k">return</span> <span class="kc">false</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">_qState</span> <span class="o">===</span> <span class="m">1</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">_shift</span><span class="o">();</span>
<span class="o">}</span>
<span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;Object queued. Transaction id is&#39;</span> <span class="o">+</span> <span class="nx">id</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;io&#39;</span><span class="o">);</span>
<span class="k">return</span> <span class="nx">id</span><span class="o">;</span>
<span class="o">};</span>
<span class="c">/**</span>
<span class="c"> * @description Method for promoting a transaction to the top of the queue.</span>
<span class="c"> *</span>
<span class="c"> * @method _unshift</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @return void</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">_unshift</span><span class="o">(</span><span class="nx">id</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">r</span><span class="o">;</span>
<span class="k">for</span> <span class="o">(</span><span class="k">var</span> <span class="nx">i</span> <span class="o">=</span> <span class="m">0</span><span class="o">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">_q</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="nx">i</span><span class="o">++)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">_q</span><span class="o">[</span><span class="nx">i</span><span class="o">].</span><span class="nx">id</span> <span class="o">===</span> <span class="nx">id</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">r</span> <span class="o">=</span> <span class="nx">_q</span><span class="o">.</span><span class="nx">splice</span><span class="o">(</span><span class="nx">i</span><span class="o">,</span> <span class="m">1</span><span class="o">);</span>
<span class="k">var</span> <span class="nx">p</span> <span class="o">=</span> <span class="nx">_q</span><span class="o">.</span><span class="nx">unshift</span><span class="o">(</span><span class="nx">r</span><span class="o">[</span><span class="m">0</span><span class="o">]);</span>
<span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;Object promoted to top of queue. Transaction id is&#39;</span> <span class="o">+</span> <span class="nx">id</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;io&#39;</span><span class="o">);</span>
<span class="k">break</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">};</span>
<span class="c">/**</span>
<span class="c"> * @description Method for removing a transaction from the top of the</span>
<span class="c"> * queue, and sending the transaction to _io().</span>
<span class="c"> *</span>
<span class="c"> * @method _shift</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @return void</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">_shift</span><span class="o">()</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">c</span> <span class="o">=</span> <span class="nx">_q</span><span class="o">.</span><span class="nx">shift</span><span class="o">();</span>
<span class="nx">_io</span><span class="o">(</span><span class="nx">c</span><span class="o">.</span><span class="nx">uri</span><span class="o">,</span> <span class="nx">c</span><span class="o">.</span><span class="nx">cfg</span><span class="o">,</span> <span class="nx">c</span><span class="o">.</span><span class="nx">id</span><span class="o">);</span>
<span class="o">};</span>
<span class="c">/**</span>
<span class="c"> * @description Method to query the current size of the queue, or to</span>
<span class="c"> * set a maximum queue size.</span>
<span class="c"> *</span>
<span class="c"> * @method _size</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @return int</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">_size</span><span class="o">(</span><span class="nx">i</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">i</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">_qMaxSize</span> <span class="o">=</span> <span class="nx">i</span><span class="o">;</span>
<span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;Queue size set to &#39;</span> <span class="o">+</span> <span class="nx">i</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;io&#39;</span><span class="o">);</span>
<span class="k">return</span> <span class="nx">i</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="k">return</span> <span class="nx">_q</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">};</span>
<span class="c">/**</span>
<span class="c"> * @description Method for setting the queue to active. If there are</span>
<span class="c"> * transactions pending in the queue, they will be processed from the</span>
<span class="c"> * queue in FIFO order.</span>
<span class="c"> *</span>
<span class="c"> * @method _start</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @return void</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">_start</span><span class="o">()</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">len</span> <span class="o">=</span> <span class="o">(</span><span class="nx">_q</span><span class="o">.</span><span class="nx">length</span> <span class="o">&gt;</span> <span class="nx">_qMaxSize</span> <span class="o">&gt;</span> <span class="m">0</span><span class="o">)</span> <span class="o">?</span> <span class="nx">_qMaxSize</span> <span class="o">:</span> <span class="nx">_q</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">len</span> <span class="o">&gt;</span> <span class="m">1</span><span class="o">)</span> <span class="o">{</span>
<span class="k">for</span> <span class="o">(</span><span class="k">var</span> <span class="nx">i</span><span class="o">=</span><span class="m">0</span><span class="o">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">len</span><span class="o">;</span> <span class="nx">i</span><span class="o">++)</span> <span class="o">{</span>
<span class="nx">_shift</span><span class="o">();</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="nx">_shift</span><span class="o">();</span>
<span class="o">}</span>
<span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;Queue started.&#39;</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;io&#39;</span><span class="o">);</span>
<span class="o">};</span>
<span class="c">/**</span>
<span class="c"> * @description Method for setting queue processing to inactive.</span>
<span class="c"> * Transaction requests to YUI.io.queue() will be stored in the queue, but</span>
<span class="c"> * not processed until the queue is reset to &quot;active&quot;.</span>
<span class="c"> *</span>
<span class="c"> * @method _stop</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @return void</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">_stop</span><span class="o">()</span> <span class="o">{</span>
<span class="nx">_qState</span> <span class="o">=</span> <span class="m">0</span><span class="o">;</span>
<span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;Queue stopped.&#39;</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;io&#39;</span><span class="o">);</span>
<span class="o">};</span>
<span class="c">/**</span>
<span class="c"> * @description Method for removing a specific, pending transaction from</span>
<span class="c"> * the queue.</span>
<span class="c"> *</span>
<span class="c"> * @method _purge</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @return void</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">_purge</span><span class="o">(</span><span class="nx">id</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">Y</span><span class="o">.</span><span class="nx">Lang</span><span class="o">.</span><span class="nx">isNumber</span><span class="o">(</span><span class="nx">id</span><span class="o">))</span> <span class="o">{</span>
<span class="k">for</span> <span class="o">(</span><span class="k">var</span> <span class="nx">i</span> <span class="o">=</span> <span class="m">0</span><span class="o">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">_q</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="nx">i</span><span class="o">++)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">_q</span><span class="o">[</span><span class="nx">i</span><span class="o">].</span><span class="nx">id</span> <span class="o">===</span> <span class="nx">id</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">_q</span><span class="o">.</span><span class="nx">splice</span><span class="o">(</span><span class="nx">i</span><span class="o">,</span> <span class="m">1</span><span class="o">);</span>
<span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;Object purged from queue. Transaction id is&#39;</span> <span class="o">+</span> <span class="nx">id</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;io&#39;</span><span class="o">);</span>
<span class="k">break</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">};</span>
<span class="c">/* End Queue Functions */</span>
<span class="c">/**</span>
<span class="c"> * @description Method for requesting a transaction. _io() is implemented as</span>
<span class="c"> * yui.io(). Each transaction may include a configuration object. Its</span>
<span class="c"> * properties are:</span>
<span class="c"> *</span>
<span class="c"> * method: HTTP method verb (e.g., GET or POST). If this property is not</span>
<span class="c"> * not defined, the default value will be GET.</span>
<span class="c"> *</span>
<span class="c"> * data: This is the name-value string that will be sent as the transaction</span>
<span class="c"> * data. If the request is HTTP GET, the data become part of</span>
<span class="c"> * querystring. If HTTP POST, the data are sent in the message body.</span>
<span class="c"> *</span>
<span class="c"> * xdr: Defines the transport to be used for cross-domain requests. By</span>
<span class="c"> * setting this property, the transaction will use the specified</span>
<span class="c"> * transport instead of XMLHttpRequest. Currently, the only alternate</span>
<span class="c"> * transport supported is Flash (e.g., { xdr: &#39;flash&#39; }).</span>
<span class="c"> *</span>
<span class="c"> * form: This is a defined object used to process HTML form as data. The</span>
<span class="c"> * properties are:</span>
<span class="c"> * {</span>
<span class="c"> * id: object, //HTML form object or id of HTML form</span>
<span class="c"> * useDisabled: boolean, //Allow disabled HTML form field values</span>
<span class="c"> * to be sent as part of the data.</span>
<span class="c"> * }</span>
<span class="c"> *</span>
<span class="c"> * on: This is a defined object used to create and handle specific</span>
<span class="c"> * events during a transaction lifecycle. These events will fire in</span>
<span class="c"> * addition to the global io events. The events are:</span>
<span class="c"> * start - This event is fired when a request is sent to a resource.</span>
<span class="c"> * complete - This event fires when the transaction is complete.</span>
<span class="c"> * success - This event fires when the response status resolves to</span>
<span class="c"> * HTTP 2xx.</span>
<span class="c"> * failure - This event fires when the response status resolves to</span>
<span class="c"> * HTTP 4xx, 5xx, and beyond.</span>
<span class="c"> * abort - This even is fired when a transaction abort is fire by</span>
<span class="c"> * timeout, or when it is manually aborted.</span>
<span class="c"> *</span>
<span class="c"> * The properties are:</span>
<span class="c"> * {</span>
<span class="c"> * start: function(id, args){},</span>
<span class="c"> * complete: function(id, responseobject, args){},</span>
<span class="c"> * success: function(id, responseobject, args){},</span>
<span class="c"> * failure: function(id, responseobject, args){},</span>
<span class="c"> * abort: function(id, args){}</span>
<span class="c"> * }</span>
<span class="c"> * Each property can reference a function or be written as an</span>
<span class="c"> * inline function.</span>
<span class="c"> *</span>
<span class="c"> * context: Object reference for an event handler when it is implemented</span>
<span class="c"> * as a method of a base object. Defining &quot;context&quot; will preserve</span>
<span class="c"> * the proper reference of &quot;this&quot; used in the event handler.</span>
<span class="c"> * headers: This is a defined object of client headers, as many as.</span>
<span class="c"> * desired for the transaction. These headers are sentThe object</span>
<span class="c"> * pattern is:</span>
<span class="c"> * {</span>
<span class="c"> * header: value</span>
<span class="c"> * }</span>
<span class="c"> *</span>
<span class="c"> * timeout: This value, defined as milliseconds, is a time threshold for the</span>
<span class="c"> * transaction. When this threshold is reached, and the transaction&#39;s</span>
<span class="c"> * Complete event has not yet fired, the transaction will be aborted.</span>
<span class="c"> * arguments: Object, array, string, or number passed to all registered</span>
<span class="c"> * event handlers. This value is available as the second</span>
<span class="c"> * argument in the &quot;start&quot; and &quot;abort&quot; event handlers; and, it is</span>
<span class="c"> * the third argument in the &quot;complete&quot;, &quot;success&quot;, and &quot;failure&quot;</span>
<span class="c"> * event handlers.</span>
<span class="c"> *</span>
<span class="c"> * @method _io</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @param {string} uri - qualified path to transaction resource.</span>
<span class="c"> * @param {object} c - configuration object for the transaction.</span>
<span class="c"> * @return object</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">_io</span><span class="o">(</span><span class="nx">uri</span><span class="o">,</span> <span class="nx">c</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">c</span> <span class="o">=</span> <span class="nx">c</span> <span class="o">||</span> <span class="o">{};</span>
<span class="k">var</span> <span class="nx">o</span> <span class="o">=</span> <span class="nx">_create</span><span class="o">((</span><span class="nx">arguments</span><span class="o">.</span><span class="nx">length</span> <span class="o">===</span> <span class="m">3</span><span class="o">)</span> <span class="o">?</span> <span class="nx">arguments</span><span class="o">[</span><span class="m">2</span><span class="o">]</span> <span class="o">:</span> <span class="kc">null</span><span class="o">,</span> <span class="nx">c</span><span class="o">);</span>
<span class="k">var</span> <span class="nx">m</span> <span class="o">=</span> <span class="o">(</span><span class="nx">c</span><span class="o">.</span><span class="nx">method</span><span class="o">)</span> <span class="o">?</span> <span class="nx">c</span><span class="o">.</span><span class="nx">method</span><span class="o">.</span><span class="nx">toUpperCase</span><span class="o">()</span> <span class="o">:</span> <span class="s1">&#39;GET&#39;</span><span class="o">;</span>
<span class="k">var</span> <span class="nx">d</span> <span class="o">=</span> <span class="o">(</span><span class="nx">c</span><span class="o">.</span><span class="nx">data</span><span class="o">)</span> <span class="o">?</span> <span class="nx">c</span><span class="o">.</span><span class="nx">data</span> <span class="o">:</span> <span class="kc">null</span><span class="o">;</span>
<span class="c">/* Determine configuration properties */</span>
<span class="c">// If config.form is defined, perform data operations.</span>
<span class="c"></span> <span class="k">if</span> <span class="o">(</span><span class="nx">c</span><span class="o">.</span><span class="nx">form</span><span class="o">)</span> <span class="o">{</span>
<span class="c">// Serialize the HTML form into a string of name-value pairs.</span>
<span class="c"></span> <span class="k">var</span> <span class="nx">f</span> <span class="o">=</span> <span class="nx">_serialize</span><span class="o">(</span><span class="nx">c</span><span class="o">.</span><span class="nx">form</span><span class="o">);</span>
<span class="c">// If config.data is defined, concatenate the data to the form string.</span>
<span class="c"></span> <span class="k">if</span> <span class="o">(</span><span class="nx">d</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">f</span> <span class="o">+=</span> <span class="s2">&quot;&amp;&quot;</span> <span class="o">+</span> <span class="nx">d</span><span class="o">;</span>
<span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;Configuration object.data added to serialized HTML form data. The string is: &#39;</span> <span class="o">+</span> <span class="nx">f</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;io&#39;</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">m</span> <span class="o">===</span> <span class="s1">&#39;POST&#39;</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">d</span> <span class="o">=</span> <span class="nx">f</span><span class="o">;</span>
<span class="nx">_setHeader</span><span class="o">(</span><span class="s1">&#39;Content-Type&#39;</span><span class="o">,</span> <span class="s1">&#39;application/x-www-form-urlencoded&#39;</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="nx">m</span> <span class="o">===</span> <span class="s1">&#39;GET&#39;</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">uri</span> <span class="o">=</span> <span class="nx">_concat</span><span class="o">(</span><span class="nx">uri</span><span class="o">,</span> <span class="nx">f</span><span class="o">);</span>
<span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;Configuration object.data added to serialized HTML form data. The querystring is: &#39;</span> <span class="o">+</span> <span class="nx">uri</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;io&#39;</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="nx">d</span> <span class="o">&amp;&amp;</span> <span class="nx">m</span> <span class="o">===</span> <span class="s1">&#39;GET&#39;</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">uri</span> <span class="o">=</span> <span class="nx">_concat</span><span class="o">(</span><span class="nx">uri</span><span class="o">,</span> <span class="nx">c</span><span class="o">.</span><span class="nx">data</span><span class="o">);</span>
<span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;Configuration object data added to URI. The querystring is: &#39;</span> <span class="o">+</span> <span class="nx">uri</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;io&#39;</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">else</span> <span class="k">if</span> <span class="o">(</span><span class="nx">d</span> <span class="o">&amp;&amp;</span> <span class="nx">m</span> <span class="o">===</span> <span class="s1">&#39;POST&#39;</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">_setHeader</span><span class="o">(</span><span class="s1">&#39;Content-Type&#39;</span><span class="o">,</span> <span class="s1">&#39;application/x-www-form-urlencoded; charset=UTF-8&#39;</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">c</span><span class="o">.</span><span class="nx">xdr</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">c</span><span class="o">.</span><span class="nx">on</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">_fn</span><span class="o">[</span><span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">]</span> <span class="o">=</span> <span class="nx">c</span><span class="o">.</span><span class="nx">on</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">d</span> <span class="o">&amp;&amp;</span> <span class="nx">m</span> <span class="o">!==</span> <span class="s1">&#39;GET&#39;</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">c</span><span class="o">.</span><span class="nx">data</span> <span class="o">=</span> <span class="nx">d</span><span class="o">;</span>
<span class="o">}</span>
<span class="nx">o</span><span class="o">.</span><span class="nx">c</span><span class="o">.</span><span class="nx">send</span><span class="o">(</span><span class="nx">uri</span><span class="o">,</span> <span class="nx">c</span><span class="o">,</span> <span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">);</span>
<span class="k">return</span> <span class="nx">o</span><span class="o">;</span>
<span class="o">}</span>
<span class="c">// If config.timeout is defined, initialize timeout poll.</span>
<span class="c"></span> <span class="k">if</span> <span class="o">(</span><span class="nx">c</span><span class="o">.</span><span class="nx">timeout</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">_startTimeout</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="nx">c</span><span class="o">);</span>
<span class="o">}</span>
<span class="c">/* End Configuration Properties */</span>
<span class="nx">o</span><span class="o">.</span><span class="nx">c</span><span class="o">.</span><span class="nx">onreadystatechange</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span> <span class="nx">_readyState</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="nx">c</span><span class="o">);</span> <span class="o">};</span>
<span class="nx">_open</span><span class="o">(</span><span class="nx">o</span><span class="o">.</span><span class="nx">c</span><span class="o">,</span> <span class="nx">m</span><span class="o">,</span> <span class="nx">uri</span><span class="o">);</span>
<span class="nx">_setHeaders</span><span class="o">(</span><span class="nx">o</span><span class="o">.</span><span class="nx">c</span><span class="o">,</span> <span class="o">(</span><span class="nx">c</span><span class="o">.</span><span class="nx">headers</span> <span class="o">||</span> <span class="o">{}));</span>
<span class="c">// Do not pass null, in the absence of data, as this</span>
<span class="c"></span> <span class="c">// results in a POST request with no Content-Length</span>
<span class="c"></span> <span class="c">// defined.</span>
<span class="c"></span> <span class="nx">_async</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="o">(</span><span class="nx">d</span> <span class="o">||</span> <span class="s1">&#39;&#39;</span><span class="o">),</span> <span class="nx">c</span><span class="o">);</span>
<span class="nx">o</span><span class="o">.</span><span class="nx">abort</span> <span class="o">=</span> <span class="k">function</span> <span class="o">()</span> <span class="o">{</span>
<span class="nx">_ioAbort</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="nx">c</span><span class="o">);</span>
<span class="o">}</span>
<span class="nx">o</span><span class="o">.</span><span class="nx">isInProgress</span> <span class="o">=</span> <span class="k">function</span><span class="o">()</span> <span class="o">{</span>
<span class="k">return</span> <span class="nx">o</span><span class="o">.</span><span class="nx">c</span><span class="o">.</span><span class="nx">readyState</span> <span class="o">!==</span> <span class="m">4</span> <span class="o">&amp;&amp;</span> <span class="nx">o</span><span class="o">.</span><span class="nx">c</span><span class="o">.</span><span class="nx">readyState</span> <span class="o">!==</span> <span class="m">0</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">return</span> <span class="nx">o</span><span class="o">;</span>
<span class="o">};</span>
<span class="c">/**</span>
<span class="c"> * @description Method for creating and subscribing transaction events.</span>
<span class="c"> *</span>
<span class="c"> * @method _tPubSub</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @param {string} e - event to be published</span>
<span class="c"> * @param {object} c - configuration object for the transaction.</span>
<span class="c"> *</span>
<span class="c"> * @return void</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">_tPubSub</span><span class="o">(</span><span class="nx">e</span><span class="o">,</span> <span class="nx">c</span><span class="o">){</span>
<span class="k">var</span> <span class="nx">event</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Event</span><span class="o">.</span><span class="nx">Target</span><span class="o">().</span><span class="nx">publish</span><span class="o">(</span><span class="s1">&#39;transaction:&#39;</span> <span class="o">+</span> <span class="nx">e</span><span class="o">);</span>
<span class="nx">event</span><span class="o">.</span><span class="nx">subscribe</span><span class="o">(</span><span class="nx">c</span><span class="o">.</span><span class="nx">on</span><span class="o">[</span><span class="nx">e</span><span class="o">],</span> <span class="o">(</span><span class="nx">c</span><span class="o">.</span><span class="nx">context</span> <span class="o">||</span> <span class="k">this</span><span class="o">),</span> <span class="nx">c</span><span class="o">.</span><span class="nx">arguments</span><span class="o">);</span>
<span class="k">return</span> <span class="nx">event</span><span class="o">;</span>
<span class="o">};</span>
<span class="k">function</span> <span class="nx">_ioXdrReady</span><span class="o">(</span><span class="nx">id</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">Y</span><span class="o">.</span><span class="nx">fire</span><span class="o">(</span><span class="nx">E_XDR_READY</span><span class="o">,</span> <span class="nx">id</span><span class="o">);</span>
<span class="o">}</span>
<span class="c">/**</span>
<span class="c"> * @description Fires event &quot;io:start&quot; and creates, fires a</span>
<span class="c"> * transaction-specific start event, if config.on.start is</span>
<span class="c"> * defined.</span>
<span class="c"> *</span>
<span class="c"> * @method _ioStart</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @param {number} id - transaction id</span>
<span class="c"> * @param {object} c - configuration object for the transaction.</span>
<span class="c"> *</span>
<span class="c"> * @return void</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">_ioStart</span><span class="o">(</span><span class="nx">id</span><span class="o">,</span> <span class="nx">c</span><span class="o">)</span> <span class="o">{</span>
<span class="c">// Set default value of argument c, property &quot;on&quot; to Object if</span>
<span class="c"></span> <span class="c">// the property is null or undefined.</span>
<span class="c"></span> <span class="nx">c</span><span class="o">.</span><span class="nx">on</span> <span class="o">=</span> <span class="nx">c</span><span class="o">.</span><span class="nx">on</span> <span class="o">||</span> <span class="o">{};</span>
<span class="k">var</span> <span class="nx">event</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">_fn</span><span class="o">[</span><span class="nx">id</span><span class="o">]</span> <span class="o">&amp;&amp;</span> <span class="nx">_fn</span><span class="o">[</span><span class="nx">id</span><span class="o">].</span><span class="nx">start</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">c</span><span class="o">.</span><span class="nx">on</span><span class="o">.</span><span class="nx">start</span> <span class="o">=</span> <span class="nx">_fn</span><span class="o">[</span><span class="nx">id</span><span class="o">].</span><span class="nx">start</span><span class="o">;</span>
<span class="o">}</span>
<span class="nx">Y</span><span class="o">.</span><span class="nx">fire</span><span class="o">(</span><span class="nx">E_START</span><span class="o">,</span> <span class="nx">id</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">c</span><span class="o">.</span><span class="nx">on</span><span class="o">.</span><span class="nx">start</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">event</span> <span class="o">=</span> <span class="nx">_tPubSub</span><span class="o">(</span><span class="s1">&#39;start&#39;</span><span class="o">,</span> <span class="nx">c</span><span class="o">);</span>
<span class="nx">event</span><span class="o">.</span><span class="nx">fire</span><span class="o">(</span><span class="nx">id</span><span class="o">);</span>
<span class="o">}</span>
<span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;Transaction &#39;</span> <span class="o">+</span> <span class="nx">id</span> <span class="o">+</span> <span class="s1">&#39; started.&#39;</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;io&#39;</span><span class="o">);</span>
<span class="o">};</span>
<span class="c">/**</span>
<span class="c"> * @description Fires event &quot;io:complete&quot; and creates, fires a</span>
<span class="c"> * transaction-specific &quot;complete&quot; event, if config.on.complete is</span>
<span class="c"> * defined.</span>
<span class="c"> *</span>
<span class="c"> * @method _ioComplete</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @param {object} id - transaction object.</span>
<span class="c"> * @param {object} c - configuration object for the transaction.</span>
<span class="c"> *</span>
<span class="c"> * @return void</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">_ioComplete</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="nx">c</span><span class="o">)</span> <span class="o">{</span>
<span class="c">// Set default value of argument c, property &quot;on&quot; to Object if</span>
<span class="c"></span> <span class="c">// the property is null or undefined.</span>
<span class="c"></span> <span class="nx">c</span><span class="o">.</span><span class="nx">on</span> <span class="o">=</span> <span class="nx">c</span><span class="o">.</span><span class="nx">on</span> <span class="o">||</span> <span class="o">{};</span>
<span class="k">var</span> <span class="nx">event</span><span class="o">;</span>
<span class="nx">Y</span><span class="o">.</span><span class="nx">fire</span><span class="o">(</span><span class="nx">E_COMPLETE</span><span class="o">,</span> <span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">,</span> <span class="nx">o</span><span class="o">.</span><span class="nx">c</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">c</span><span class="o">.</span><span class="nx">on</span><span class="o">.</span><span class="nx">complete</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">event</span> <span class="o">=</span> <span class="nx">_tPubSub</span><span class="o">(</span><span class="s1">&#39;complete&#39;</span><span class="o">,</span> <span class="nx">c</span><span class="o">);</span>
<span class="nx">event</span><span class="o">.</span><span class="nx">fire</span><span class="o">(</span><span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">,</span> <span class="nx">o</span><span class="o">.</span><span class="nx">c</span><span class="o">);</span>
<span class="o">}</span>
<span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;Transaction &#39;</span> <span class="o">+</span> <span class="nx">o</span><span class="o">.</span><span class="nx">id</span> <span class="o">+</span> <span class="s1">&#39; completed.&#39;</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;io&#39;</span><span class="o">);</span>
<span class="o">}</span>
<span class="c">/**</span>
<span class="c"> * @description Fires event &quot;io:success&quot; and creates, fires a</span>
<span class="c"> * transaction-specific &quot;success&quot; event, if config.on.success is</span>
<span class="c"> * defined.</span>
<span class="c"> *</span>
<span class="c"> * @method _ioSuccess</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @param {object} o - transaction object.</span>
<span class="c"> * @param {object} c - configuration object for the transaction.</span>
<span class="c"> *</span>
<span class="c"> * @return void</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">_ioSuccess</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="nx">c</span><span class="o">)</span> <span class="o">{</span>
<span class="c">// Set default value of argument c, property &quot;on&quot; to Object if</span>
<span class="c"></span> <span class="c">// the property is null or undefined.</span>
<span class="c"></span> <span class="nx">c</span><span class="o">.</span><span class="nx">on</span> <span class="o">=</span> <span class="nx">c</span><span class="o">.</span><span class="nx">on</span> <span class="o">||</span> <span class="o">{};</span>
<span class="k">var</span> <span class="nx">event</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">_fn</span><span class="o">[</span><span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">]</span> <span class="o">&amp;&amp;</span> <span class="nx">_fn</span><span class="o">[</span><span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">].</span><span class="nx">success</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">c</span><span class="o">.</span><span class="nx">on</span><span class="o">.</span><span class="nx">success</span> <span class="o">=</span> <span class="nx">_fn</span><span class="o">[</span><span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">].</span><span class="nx">success</span><span class="o">;</span>
<span class="nx">delete</span> <span class="nx">_fn</span><span class="o">[</span><span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">];</span>
<span class="c">//Decode the response from IO.swf</span>
<span class="c"></span> <span class="nx">o</span><span class="o">.</span><span class="nx">c</span><span class="o">.</span><span class="nx">responseText</span> <span class="o">=</span> <span class="nb">decodeURI</span><span class="o">(</span><span class="nx">o</span><span class="o">.</span><span class="nx">c</span><span class="o">.</span><span class="nx">responseText</span><span class="o">);</span>
<span class="o">}</span>
<span class="nx">Y</span><span class="o">.</span><span class="nx">fire</span><span class="o">(</span><span class="nx">E_SUCCESS</span><span class="o">,</span> <span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">,</span> <span class="nx">o</span><span class="o">.</span><span class="nx">c</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">c</span><span class="o">.</span><span class="nx">on</span><span class="o">.</span><span class="nx">success</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">event</span> <span class="o">=</span> <span class="nx">_tPubSub</span><span class="o">(</span><span class="s1">&#39;success&#39;</span><span class="o">,</span> <span class="nx">c</span><span class="o">);</span>
<span class="nx">event</span><span class="o">.</span><span class="nx">fire</span><span class="o">(</span><span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">,</span> <span class="nx">o</span><span class="o">.</span><span class="nx">c</span><span class="o">);</span>
<span class="o">}</span>
<span class="nx">_destroy</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="o">(</span><span class="nx">c</span><span class="o">.</span><span class="nx">xdr</span><span class="o">)</span> <span class="o">?</span> <span class="kc">true</span> <span class="o">:</span> <span class="kc">false</span> <span class="o">);</span>
<span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;HTTP Status evaluates to Success. The transaction is: &#39;</span> <span class="o">+</span> <span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;io&#39;</span><span class="o">);</span>
<span class="o">}</span>
<span class="c">/**</span>
<span class="c"> * @description Fires event &quot;io:failure&quot; and creates, fires a</span>
<span class="c"> * transaction-specific &quot;failure&quot; event, if config.on.failure is</span>
<span class="c"> * defined.</span>
<span class="c"> *</span>
<span class="c"> * @method _ioFailure</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @param {object} o - transaction object.</span>
<span class="c"> * @param {object} c - configuration object for the transaction.</span>
<span class="c"> *</span>
<span class="c"> * @return void</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">_ioFailure</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="nx">c</span><span class="o">)</span> <span class="o">{</span>
<span class="c">// Set default value of argument c, property &quot;on&quot; to Object if</span>
<span class="c"></span> <span class="c">// the property is null or undefined.</span>
<span class="c"></span> <span class="nx">c</span><span class="o">.</span><span class="nx">on</span> <span class="o">=</span> <span class="nx">c</span><span class="o">.</span><span class="nx">on</span> <span class="o">||</span> <span class="o">{};</span>
<span class="k">var</span> <span class="nx">event</span><span class="o">;</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">_fn</span><span class="o">[</span><span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">]</span> <span class="o">&amp;&amp;</span> <span class="nx">_fn</span><span class="o">[</span><span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">].</span><span class="nx">failure</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">c</span><span class="o">.</span><span class="nx">on</span><span class="o">.</span><span class="nx">failure</span> <span class="o">=</span> <span class="nx">_fn</span><span class="o">[</span><span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">].</span><span class="nx">failure</span><span class="o">;</span>
<span class="nx">delete</span> <span class="nx">_fn</span><span class="o">[</span><span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">];</span>
<span class="c">//Decode the response from IO.swf</span>
<span class="c"></span> <span class="nx">o</span><span class="o">.</span><span class="nx">c</span><span class="o">.</span><span class="nx">responseText</span> <span class="o">=</span> <span class="nb">decodeURI</span><span class="o">(</span><span class="nx">o</span><span class="o">.</span><span class="nx">c</span><span class="o">.</span><span class="nx">responseText</span><span class="o">);</span>
<span class="o">}</span>
<span class="nx">Y</span><span class="o">.</span><span class="nx">fire</span><span class="o">(</span><span class="nx">E_FAILURE</span><span class="o">,</span> <span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">,</span> <span class="nx">o</span><span class="o">.</span><span class="nx">c</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">c</span><span class="o">.</span><span class="nx">on</span><span class="o">.</span><span class="nx">failure</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">event</span> <span class="o">=</span> <span class="nx">_tPubSub</span><span class="o">(</span><span class="s1">&#39;failure&#39;</span><span class="o">,</span> <span class="nx">c</span><span class="o">);</span>
<span class="nx">event</span><span class="o">.</span><span class="nx">fire</span><span class="o">(</span><span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">,</span> <span class="nx">o</span><span class="o">.</span><span class="nx">c</span><span class="o">);</span>
<span class="o">}</span>
<span class="nx">_destroy</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="o">(</span><span class="nx">c</span><span class="o">.</span><span class="nx">xdr</span><span class="o">)</span> <span class="o">?</span> <span class="kc">true</span> <span class="o">:</span> <span class="kc">false</span> <span class="o">);</span>
<span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;HTTP Status evaluates to Failure. The transaction is: &#39;</span> <span class="o">+</span> <span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;io&#39;</span><span class="o">);</span>
<span class="o">}</span>
<span class="c">/**</span>
<span class="c"> * @description Fires event &quot;io:abort&quot; and creates, fires a</span>
<span class="c"> * transaction-specific &quot;abort&quot; event, if config.on.abort is</span>
<span class="c"> * defined.</span>
<span class="c"> *</span>
<span class="c"> * @method _ioAbort</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @param {object} o - Transaction object generated by _create().</span>
<span class="c"> * @param {object} c - Configuration object passed to YUI.io().</span>
<span class="c"> *</span>
<span class="c"> * @return void</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">_ioAbort</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="nx">c</span><span class="o">)</span> <span class="o">{</span>
<span class="c">// Set default value of argument c, property &quot;on&quot; to Object if</span>
<span class="c"></span> <span class="c">// the property is null or undefined.</span>
<span class="c"></span> <span class="nx">c</span><span class="o">.</span><span class="nx">on</span> <span class="o">=</span> <span class="nx">c</span><span class="o">.</span><span class="nx">on</span> <span class="o">||</span> <span class="o">{};</span>
<span class="k">var</span> <span class="nx">event</span><span class="o">;</span>
<span class="k">if</span><span class="o">(</span><span class="nx">o</span> <span class="o">&amp;&amp;</span> <span class="nx">o</span><span class="o">.</span><span class="nx">c</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nx">c</span><span class="o">.</span><span class="nx">xdr</span><span class="o">)</span> <span class="o">{</span>
<span class="c">// Terminate the transaction</span>
<span class="c"></span> <span class="nx">o</span><span class="o">.</span><span class="nx">c</span><span class="o">.</span><span class="nx">abort</span><span class="o">();</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">c</span><span class="o">)</span> <span class="o">{</span>
<span class="c">// Clear the timeout poll for this specific transaction.</span>
<span class="c"></span> <span class="k">if</span> <span class="o">(</span><span class="nx">c</span><span class="o">.</span><span class="nx">timeout</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">_clearTimeout</span><span class="o">(</span><span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">_fn</span><span class="o">[</span><span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">]</span> <span class="o">&amp;&amp;</span> <span class="nx">_fn</span><span class="o">[</span><span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">].</span><span class="nx">abort</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">c</span><span class="o">.</span><span class="nx">on</span><span class="o">.</span><span class="nx">abort</span> <span class="o">=</span> <span class="nx">_fn</span><span class="o">[</span><span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">].</span><span class="nx">abort</span><span class="o">;</span>
<span class="nx">delete</span> <span class="nx">_fn</span><span class="o">[</span><span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">];</span>
<span class="o">}</span>
<span class="nx">Y</span><span class="o">.</span><span class="nx">fire</span><span class="o">(</span><span class="nx">E_ABORT</span><span class="o">,</span> <span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">);</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">c</span><span class="o">.</span><span class="nx">on</span><span class="o">.</span><span class="nx">abort</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">event</span> <span class="o">=</span> <span class="nx">_tPubSub</span><span class="o">(</span><span class="s1">&#39;abort&#39;</span><span class="o">,</span> <span class="nx">c</span><span class="o">);</span>
<span class="nx">event</span><span class="o">.</span><span class="nx">fire</span><span class="o">(</span><span class="nx">id</span><span class="o">);</span>
<span class="o">}</span>
<span class="nx">_destroy</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="o">(</span><span class="nx">c</span><span class="o">.</span><span class="nx">xdr</span><span class="o">)</span> <span class="o">?</span> <span class="kc">true</span> <span class="o">:</span> <span class="kc">false</span> <span class="o">);</span>
<span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;Transaction timeout or explicit abort. The transaction is: &#39;</span> <span class="o">+</span> <span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;io&#39;</span><span class="o">);</span>
<span class="o">}</span>
<span class="c">/**</span>
<span class="c"> * @description Method that creates the XMLHttpRequest transport</span>
<span class="c"> *</span>
<span class="c"> * @method _xhr</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @return object</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">_xhr</span><span class="o">()</span> <span class="o">{</span>
<span class="k">return</span> <span class="o">(</span><span class="nx">w</span><span class="o">.</span><span class="nx">XMLHttpRequest</span><span class="o">)</span> <span class="o">?</span> <span class="k">new</span> <span class="nx">XMLHttpRequest</span><span class="o">()</span> <span class="o">:</span> <span class="k">new</span> <span class="nx">ActiveXObject</span><span class="o">(</span><span class="s1">&#39;Microsoft.XMLHTTP&#39;</span><span class="o">);</span>
<span class="o">};</span>
<span class="c">/**</span>
<span class="c"> * @description Method that creates the Flash transport swf.</span>
<span class="c"> *</span>
<span class="c"> * @method _swf</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @param {string} uri - location of IO.swf.</span>
<span class="c"> * @param {string} yid - string representation of YUI instance.</span>
<span class="c"> * @return void</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">_swf</span><span class="o">(</span><span class="nx">uri</span><span class="o">,</span> <span class="nx">yid</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">b</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Node</span><span class="o">.</span><span class="nx">get</span><span class="o">(</span><span class="s2">&quot;body&quot;</span><span class="o">);</span>
<span class="k">var</span> <span class="nx">swf</span> <span class="o">=</span> <span class="s1">&#39;&lt;object id=&quot;yuiSwfIo&quot; type=&quot;application/x-shockwave-flash&quot; data=&quot;&#39;</span> <span class="o">+</span> <span class="nx">uri</span> <span class="o">+</span> <span class="s1">&#39;&quot; width=&quot;0&quot; height=&quot;0&quot;&gt;&#39;</span><span class="o">;</span>
<span class="nx">swf</span> <span class="o">+=</span> <span class="s1">&#39;&lt;param name=&quot;movie&quot; value=&quot;&#39;</span> <span class="o">+</span> <span class="nx">uri</span> <span class="o">+</span> <span class="s1">&#39;&quot;&gt;&#39;</span><span class="o">;</span>
<span class="nx">swf</span> <span class="o">+=</span> <span class="s1">&#39;&lt;param name=&quot;FlashVars&quot; value=&quot;yid=&#39;</span> <span class="o">+</span> <span class="nx">yid</span> <span class="o">+</span> <span class="s1">&#39;&quot;&gt;&#39;</span><span class="o">;</span>
<span class="nx">swf</span> <span class="o">+=</span> <span class="s1">&#39;&lt;param name=&quot;allowScriptAccess&quot; value=&quot;sameDomain&quot;&gt;&#39;</span><span class="o">;</span>
<span class="nx">swf</span> <span class="o">+=</span> <span class="s1">&#39;&lt;/object&gt;&#39;</span><span class="o">;</span>
<span class="nx">b</span><span class="o">.</span><span class="nx">appendChild</span><span class="o">(</span><span class="nx">Y</span><span class="o">.</span><span class="nx">Node</span><span class="o">.</span><span class="nx">create</span><span class="o">(</span><span class="nx">swf</span><span class="o">))</span>
<span class="nx">_xdr</span><span class="o">.</span><span class="nx">flash</span> <span class="o">=</span> <span class="nx">d</span><span class="o">.</span><span class="nx">getElementById</span><span class="o">(</span><span class="s1">&#39;yuiSwfIo&#39;</span><span class="o">);</span>
<span class="o">};</span>
<span class="c">/**</span>
<span class="c"> * @description Method that increments _transactionId for each transaction.</span>
<span class="c"> *</span>
<span class="c"> * @method _id</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @return int</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">_id</span><span class="o">()</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">id</span> <span class="o">=</span> <span class="nx">transactionId</span><span class="o">;</span>
<span class="nx">transactionId</span><span class="o">++;</span>
<span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;Transaction id generated. The id is: &#39;</span> <span class="o">+</span> <span class="nx">id</span><span class="o">,</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;io&#39;</span><span class="o">);</span>
<span class="k">return</span> <span class="nx">id</span><span class="o">;</span>
<span class="o">};</span>
<span class="c">/**</span>
<span class="c"> * @description Method that creates a unique transaction object for each</span>
<span class="c"> * request..</span>
<span class="c"> *</span>
<span class="c"> * @method _create</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @param {number} s - URI or root data.</span>
<span class="c"> * @param {number} c - configuration object</span>
<span class="c"> * @return object</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">_create</span><span class="o">(</span><span class="nx">i</span><span class="o">,</span> <span class="nx">c</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">o</span> <span class="o">=</span> <span class="o">{};</span>
<span class="nx">o</span><span class="o">.</span><span class="nx">id</span> <span class="o">=</span> <span class="nx">Y</span><span class="o">.</span><span class="nx">Lang</span><span class="o">.</span><span class="nx">isNumber</span><span class="o">(</span><span class="nx">i</span><span class="o">)</span> <span class="o">?</span> <span class="nx">i</span> <span class="o">:</span> <span class="nx">_id</span><span class="o">();</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">c</span> <span class="o">&amp;&amp;</span> <span class="nx">c</span><span class="o">.</span><span class="nx">xdr</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">o</span><span class="o">.</span><span class="nx">c</span> <span class="o">=</span> <span class="nx">_xdr</span><span class="o">[</span><span class="nx">c</span><span class="o">.</span><span class="nx">xdr</span><span class="o">.</span><span class="nx">use</span><span class="o">];</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="nx">o</span><span class="o">.</span><span class="nx">c</span> <span class="o">=</span> <span class="nx">_xhr</span><span class="o">();</span>
<span class="o">}</span>
<span class="k">return</span> <span class="nx">o</span><span class="o">;</span>
<span class="o">};</span>
<span class="c">/**</span>
<span class="c"> * @description Method that concatenates string data for HTTP GET transactions.</span>
<span class="c"> *</span>
<span class="c"> * @method _concat</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @param {string} s - URI or root data.</span>
<span class="c"> * @param {string} d - data to be concatenated onto URI.</span>
<span class="c"> * @return int</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">_concat</span><span class="o">(</span><span class="nx">s</span><span class="o">,</span> <span class="nx">d</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">s</span> <span class="o">+=</span> <span class="o">((</span><span class="nx">s</span><span class="o">.</span><span class="nx">indexOf</span><span class="o">(</span><span class="s1">&#39;?&#39;</span><span class="o">)</span> <span class="o">==</span> <span class="o">-</span><span class="m">1</span><span class="o">)</span> <span class="o">?</span> <span class="s1">&#39;?&#39;</span> <span class="o">:</span> <span class="s1">&#39;&amp;&#39;</span><span class="o">)</span> <span class="o">+</span> <span class="nx">d</span><span class="o">;</span>
<span class="k">return</span> <span class="nx">s</span><span class="o">;</span>
<span class="o">};</span>
<span class="c">/**</span>
<span class="c"> * @description Method that stores default client headers for all transactions.</span>
<span class="c"> * If a label is passed with no value argument, the header will be deleted.</span>
<span class="c"> *</span>
<span class="c"> * @method _setHeader</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @param {string} l - HTTP header</span>
<span class="c"> * @param {string} v - HTTP header value</span>
<span class="c"> * @return int</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">_setHeader</span><span class="o">(</span><span class="nx">l</span><span class="o">,</span> <span class="nx">v</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">v</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">_headers</span><span class="o">[</span><span class="nx">l</span><span class="o">]</span> <span class="o">=</span> <span class="nx">v</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="nx">delete</span> <span class="nx">_headers</span><span class="o">[</span><span class="nx">l</span><span class="o">];</span>
<span class="o">}</span>
<span class="o">};</span>
<span class="c">/**</span>
<span class="c"> * @description Method to initialize the desired transport medium.</span>
<span class="c"> *</span>
<span class="c"> * @method _initTransport</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @param {object} o - object of transport configurations.</span>
<span class="c"> * @return void</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">_initTransport</span><span class="o">(</span><span class="nx">o</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">switch</span> <span class="o">(</span><span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">case</span> <span class="s1">&#39;flash&#39;</span><span class="o">:</span>
<span class="nx">_swf</span><span class="o">(</span><span class="nx">o</span><span class="o">.</span><span class="nx">src</span><span class="o">,</span> <span class="nx">o</span><span class="o">.</span><span class="nx">yid</span><span class="o">);</span>
<span class="k">break</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">};</span>
<span class="c">/**</span>
<span class="c"> * @description Method that sets all HTTP headers to be sent in a transaction.</span>
<span class="c"> *</span>
<span class="c"> * @method _setHeaders</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @param {object} o - XHR instance for the specific transaction.</span>
<span class="c"> * @param {object} h - HTTP headers for the specific transaction, as defined</span>
<span class="c"> * in the configuration object passed to YUI.io().</span>
<span class="c"> * @return void</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">_setHeaders</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="nx">h</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">p</span><span class="o">;</span>
<span class="k">for</span> <span class="o">(</span><span class="nx">p</span> <span class="k">in</span> <span class="nx">_headers</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">_headers</span><span class="o">.</span><span class="nx">hasOwnProperty</span><span class="o">(</span><span class="nx">p</span><span class="o">))</span> <span class="o">{</span>
<span class="nx">h</span><span class="o">[</span><span class="nx">p</span><span class="o">]</span> <span class="o">=</span> <span class="nx">_headers</span><span class="o">[</span><span class="nx">p</span><span class="o">];</span>
<span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;Default HTTP header &#39;</span> <span class="o">+</span> <span class="nx">p</span> <span class="o">+</span> <span class="s1">&#39; found with value of &#39;</span> <span class="o">+</span> <span class="nx">_headers</span><span class="o">[</span><span class="nx">p</span><span class="o">],</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;io&#39;</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">for</span> <span class="o">(</span><span class="nx">p</span> <span class="k">in</span> <span class="nx">h</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">h</span><span class="o">.</span><span class="nx">hasOwnProperty</span><span class="o">(</span><span class="nx">p</span><span class="o">))</span> <span class="o">{</span>
<span class="nx">o</span><span class="o">.</span><span class="nx">setRequestHeader</span><span class="o">(</span><span class="nx">p</span><span class="o">,</span> <span class="nx">h</span><span class="o">[</span><span class="nx">p</span><span class="o">]);</span>
<span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;HTTP Header &#39;</span> <span class="o">+</span> <span class="nx">p</span> <span class="o">+</span> <span class="s1">&#39; set with value of &#39;</span> <span class="o">+</span> <span class="nx">h</span><span class="o">[</span><span class="nx">p</span><span class="o">],</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;io&#39;</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">};</span>
<span class="k">function</span> <span class="nx">_open</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="nx">m</span><span class="o">,</span> <span class="nx">uri</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">o</span><span class="o">.</span><span class="nx">open</span><span class="o">(</span><span class="nx">m</span><span class="o">,</span> <span class="nx">uri</span><span class="o">,</span> <span class="kc">true</span><span class="o">);</span>
<span class="o">};</span>
<span class="c">/**</span>
<span class="c"> * @description Method that sends the transaction request.</span>
<span class="c"> *</span>
<span class="c"> * @method _async</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @param {object} o - Transaction object generated by _create().</span>
<span class="c"> * @param {string} d - Transaction data.</span>
<span class="c"> * @param {object} c - Configuration object passed to YUI.io().</span>
<span class="c"> * @return void</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">_async</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="nx">d</span><span class="o">,</span> <span class="nx">c</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">o</span><span class="o">.</span><span class="nx">c</span><span class="o">.</span><span class="nx">send</span><span class="o">(</span><span class="nx">d</span><span class="o">);</span>
<span class="nx">_ioStart</span><span class="o">(</span><span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">,</span> <span class="nx">c</span><span class="o">);</span>
<span class="o">};</span>
<span class="c">/**</span>
<span class="c"> * @description Starts timeout count if config,timeout is defined.</span>
<span class="c"> *</span>
<span class="c"> * @method _startTimeout</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @param {object} o - Transaction object generated by _create().</span>
<span class="c"> * @param {object} c - Configuration object passed to YUI.io().</span>
<span class="c"> * @return void</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">_startTimeout</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="nx">c</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">_timeout</span><span class="o">[</span><span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">]</span> <span class="o">=</span> <span class="nx">w</span><span class="o">.</span><span class="nx">setTimeout</span><span class="o">(</span><span class="k">function</span><span class="o">()</span> <span class="o">{</span> <span class="nx">_ioAbort</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="nx">c</span><span class="o">);</span> <span class="o">},</span> <span class="nx">c</span><span class="o">.</span><span class="nx">timeout</span><span class="o">);</span>
<span class="o">};</span>
<span class="c">/**</span>
<span class="c"> * @description Clears the timeout interval started by _startTimeout().</span>
<span class="c"> *</span>
<span class="c"> * @method _clearTimeout</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @param {number} id - Transaction id.</span>
<span class="c"> * @return void</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">_clearTimeout</span><span class="o">(</span><span class="nx">id</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">w</span><span class="o">.</span><span class="nx">clearTimeout</span><span class="o">(</span><span class="nx">_timeout</span><span class="o">[</span><span class="nx">id</span><span class="o">]);</span>
<span class="nx">delete</span> <span class="nx">_timeout</span><span class="o">[</span><span class="nx">id</span><span class="o">];</span>
<span class="o">};</span>
<span class="c">/**</span>
<span class="c"> * @description Event handler bound to onreadystatechange.</span>
<span class="c"> *</span>
<span class="c"> * @method _readyState</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @param {object} o - Transaction object generated by _create().</span>
<span class="c"> * @param {object} c - Configuration object passed to YUI.io().</span>
<span class="c"> * @return void</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">_readyState</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="nx">c</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">o</span><span class="o">.</span><span class="nx">c</span><span class="o">.</span><span class="nx">readyState</span> <span class="o">===</span> <span class="m">4</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">c</span><span class="o">.</span><span class="nx">timeout</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">_clearTimeout</span><span class="o">(</span><span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">);</span>
<span class="o">}</span>
<span class="nx">_ioComplete</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="nx">c</span><span class="o">);</span>
<span class="nx">_handleResponse</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="nx">c</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">};</span>
<span class="c">/**</span>
<span class="c"> * @description Method that determines if a transaction response qualifies</span>
<span class="c"> * as success or failure, based on the response HTTP status code, and</span>
<span class="c"> * fires the appropriate success or failure events.</span>
<span class="c"> *</span>
<span class="c"> * @method _handleResponse</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @param {object} o - Transaction object generated by _create().</span>
<span class="c"> * @param {object} c - Configuration object passed to YUI.io().</span>
<span class="c"> * @return void</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">_handleResponse</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="nx">c</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">status</span><span class="o">;</span>
<span class="k">try</span><span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">o</span><span class="o">.</span><span class="nx">c</span><span class="o">.</span><span class="nx">status</span> <span class="o">&amp;&amp;</span> <span class="nx">o</span><span class="o">.</span><span class="nx">c</span><span class="o">.</span><span class="nx">status</span> <span class="o">!==</span> <span class="m">0</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">status</span> <span class="o">=</span> <span class="nx">o</span><span class="o">.</span><span class="nx">c</span><span class="o">.</span><span class="nx">status</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="nx">status</span> <span class="o">=</span> <span class="m">0</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">catch</span><span class="o">(</span><span class="nx">e</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">status</span> <span class="o">=</span> <span class="m">0</span><span class="o">;</span>
<span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;HTTP status unreadable. The transaction is: &#39;</span> <span class="o">+</span> <span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">,</span> <span class="s1">&#39;warn&#39;</span><span class="o">,</span> <span class="s1">&#39;io&#39;</span><span class="o">);</span>
<span class="o">}</span>
<span class="c">/*</span>
<span class="c"> * IE reports HTTP 204 as HTTP 1223.</span>
<span class="c"> * However, the response data are still available.</span>
<span class="c"> */</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">status</span> <span class="o">&gt;=</span> <span class="m">200</span> <span class="o">&amp;&amp;</span> <span class="nx">status</span> <span class="o">&lt;</span> <span class="m">300</span> <span class="o">||</span> <span class="nx">status</span> <span class="o">===</span> <span class="m">1223</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">_ioSuccess</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="nx">c</span><span class="o">);</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="nx">_ioFailure</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="nx">c</span><span class="o">);</span>
<span class="o">}</span>
<span class="o">};</span>
<span class="k">function</span> <span class="nx">_destroy</span><span class="o">(</span><span class="nx">o</span><span class="o">,</span> <span class="nx">isXdr</span><span class="o">)</span> <span class="o">{</span>
<span class="c">// IE6 will throw a &quot;Type Mismatch&quot; error if the event handler is set to &quot;null&quot;.</span>
<span class="c"></span> <span class="k">if</span><span class="o">(</span><span class="nx">w</span><span class="o">.</span><span class="nx">XMLHttpRequest</span> <span class="o">&amp;&amp;</span> <span class="o">!</span><span class="nx">isXdr</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">o</span><span class="o">.</span><span class="nx">c</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">o</span><span class="o">.</span><span class="nx">c</span><span class="o">.</span><span class="nx">onreadystatechange</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="nx">o</span><span class="o">.</span><span class="nx">c</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
<span class="nx">o</span> <span class="o">=</span> <span class="kc">null</span><span class="o">;</span>
<span class="o">};</span>
<span class="c">/**</span>
<span class="c"> * @description Method to enumerate through an HTML form&#39;s elements collection</span>
<span class="c"> * and return a string comprised of key-value pairs.</span>
<span class="c"> *</span>
<span class="c"> * @method _serialize</span>
<span class="c"> * @private</span>
<span class="c"> * @static</span>
<span class="c"> * @param {object} c - Configuration object specific to form operations..</span>
<span class="c"> * @return string</span>
<span class="c"> */</span>
<span class="k">function</span> <span class="nx">_serialize</span><span class="o">(</span><span class="nx">o</span><span class="o">)</span> <span class="o">{</span>
<span class="k">var</span> <span class="nx">str</span> <span class="o">=</span> <span class="s1">&#39;&#39;</span><span class="o">;</span>
<span class="k">var</span> <span class="nx">f</span> <span class="o">=</span> <span class="o">(</span><span class="k">typeof</span> <span class="nx">o</span><span class="o">.</span><span class="nx">id</span> <span class="o">===</span> <span class="s1">&#39;object&#39;</span><span class="o">)</span> <span class="o">?</span> <span class="nx">o</span><span class="o">.</span><span class="nx">id</span> <span class="o">:</span> <span class="nx">d</span><span class="o">.</span><span class="nx">getElementById</span><span class="o">(</span><span class="nx">o</span><span class="o">.</span><span class="nx">id</span><span class="o">);</span>
<span class="k">var</span> <span class="nx">useDf</span> <span class="o">=</span> <span class="nx">o</span><span class="o">.</span><span class="nx">useDisabled</span> <span class="o">||</span> <span class="kc">false</span><span class="o">;</span>
<span class="k">var</span> <span class="nx">eUC</span> <span class="o">=</span> <span class="nb">encodeURIComponent</span><span class="o">;</span>
<span class="k">var</span> <span class="nx">e</span><span class="o">,</span> <span class="nx">n</span><span class="o">,</span> <span class="nx">v</span><span class="o">,</span> <span class="nx">dF</span><span class="o">;</span>
<span class="c">// Iterate over the form elements collection to construct the name-value pairs.</span>
<span class="c"></span> <span class="k">for</span> <span class="o">(</span><span class="k">var</span> <span class="nx">i</span><span class="o">=</span><span class="m">0</span><span class="o">;</span> <span class="nx">i</span> <span class="o">&lt;</span> <span class="nx">f</span><span class="o">.</span><span class="nx">elements</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="nx">i</span><span class="o">++)</span> <span class="o">{</span>
<span class="nx">e</span> <span class="o">=</span> <span class="nx">f</span><span class="o">.</span><span class="nx">elements</span><span class="o">[</span><span class="nx">i</span><span class="o">];</span>
<span class="nx">dF</span> <span class="o">=</span> <span class="nx">e</span><span class="o">.</span><span class="nx">disabled</span><span class="o">;</span>
<span class="nx">n</span> <span class="o">=</span> <span class="nx">e</span><span class="o">.</span><span class="nx">name</span><span class="o">;</span>
<span class="nx">v</span> <span class="o">=</span> <span class="nx">e</span><span class="o">.</span><span class="nx">value</span><span class="o">;</span>
<span class="c">//if config.form.useDisabled is defined as true, then disabled fields</span>
<span class="c"></span> <span class="c">//will be included in the serialized data.</span>
<span class="c"></span> <span class="k">if</span> <span class="o">((</span><span class="nx">useDf</span><span class="o">)</span> <span class="o">?</span> <span class="nx">n</span> <span class="o">:</span> <span class="o">(</span><span class="nx">n</span> <span class="o">&amp;&amp;</span> <span class="nx">dF</span><span class="o">));</span>
<span class="o">{</span>
<span class="nx">switch</span> <span class="o">(</span><span class="nx">e</span><span class="o">.</span><span class="nx">type</span><span class="o">)</span>
<span class="o">{</span>
<span class="nx">case</span> <span class="s1">&#39;select-one&#39;</span><span class="o">:</span>
<span class="nx">case</span> <span class="s1">&#39;select-multiple&#39;</span><span class="o">:</span>
<span class="k">for</span> <span class="o">(</span><span class="k">var</span> <span class="nx">j</span> <span class="o">=</span> <span class="m">0</span><span class="o">;</span> <span class="nx">j</span> <span class="o">&lt;</span> <span class="nx">e</span><span class="o">.</span><span class="nx">options</span><span class="o">.</span><span class="nx">length</span><span class="o">;</span> <span class="nx">j</span><span class="o">++)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">e</span><span class="o">.</span><span class="nx">options</span><span class="o">[</span><span class="nx">j</span><span class="o">].</span><span class="nx">selected</span><span class="o">)</span> <span class="o">{</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">Y</span><span class="o">.</span><span class="nx">UA</span><span class="o">.</span><span class="nx">ie</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">str</span> <span class="o">+=</span> <span class="nx">eUC</span><span class="o">(</span><span class="nx">n</span><span class="o">)</span> <span class="o">+</span> <span class="s1">&#39;=&#39;</span> <span class="o">+</span> <span class="nx">eUC</span><span class="o">(</span><span class="nx">e</span><span class="o">.</span><span class="nx">options</span><span class="o">[</span><span class="nx">j</span><span class="o">].</span><span class="nx">attributes</span><span class="o">[</span><span class="s1">&#39;value&#39;</span><span class="o">].</span><span class="nx">specified</span> <span class="o">?</span> <span class="nx">e</span><span class="o">.</span><span class="nx">options</span><span class="o">[</span><span class="nx">j</span><span class="o">].</span><span class="nx">value</span> <span class="o">:</span> <span class="nx">e</span><span class="o">.</span><span class="nx">options</span><span class="o">[</span><span class="nx">j</span><span class="o">].</span><span class="nx">text</span><span class="o">)</span> <span class="o">+</span> <span class="s1">&#39;&amp;&#39;</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">else</span> <span class="o">{</span>
<span class="nx">str</span> <span class="o">+=</span> <span class="nx">eUC</span><span class="o">(</span><span class="nx">n</span><span class="o">)</span> <span class="o">+</span> <span class="s1">&#39;=&#39;</span> <span class="o">+</span> <span class="nx">eUC</span><span class="o">(</span><span class="nx">e</span><span class="o">.</span><span class="nx">options</span><span class="o">[</span><span class="nx">j</span><span class="o">].</span><span class="nx">hasAttribute</span><span class="o">(</span><span class="s1">&#39;value&#39;</span><span class="o">)</span> <span class="o">?</span> <span class="nx">e</span><span class="o">.</span><span class="nx">options</span><span class="o">[</span><span class="nx">j</span><span class="o">].</span><span class="nx">value</span> <span class="o">:</span> <span class="nx">e</span><span class="o">.</span><span class="nx">options</span><span class="o">[</span><span class="nx">j</span><span class="o">].</span><span class="nx">text</span><span class="o">)</span> <span class="o">+</span> <span class="s1">&#39;&amp;&#39;</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="k">break</span><span class="o">;</span>
<span class="nx">case</span> <span class="s1">&#39;radio&#39;</span><span class="o">:</span>
<span class="nx">case</span> <span class="s1">&#39;checkbox&#39;</span><span class="o">:</span>
<span class="k">if</span> <span class="o">(</span><span class="nx">e</span><span class="o">.</span><span class="nx">checked</span><span class="o">)</span> <span class="o">{</span>
<span class="nx">str</span> <span class="o">+=</span> <span class="nx">eUC</span><span class="o">(</span><span class="nx">n</span><span class="o">)</span> <span class="o">+</span> <span class="s1">&#39;=&#39;</span> <span class="o">+</span> <span class="nx">eUC</span><span class="o">(</span><span class="nx">v</span><span class="o">)</span> <span class="o">+</span> <span class="s1">&#39;&amp;&#39;</span><span class="o">;</span>
<span class="o">}</span>
<span class="k">break</span><span class="o">;</span>
<span class="nx">case</span> <span class="s1">&#39;file&#39;</span><span class="o">:</span>
<span class="nx">case</span> <span class="kc">undefined</span><span class="o">:</span>
<span class="nx">case</span> <span class="s1">&#39;reset&#39;</span><span class="o">:</span>
<span class="nx">case</span> <span class="s1">&#39;button&#39;</span><span class="o">:</span>
<span class="k">break</span><span class="o">;</span>
<span class="nx">case</span> <span class="s1">&#39;submit&#39;</span><span class="o">:</span>
<span class="nx">default</span><span class="o">:</span>
<span class="nx">str</span> <span class="o">+=</span> <span class="nx">eUC</span><span class="o">(</span><span class="nx">n</span><span class="o">)</span> <span class="o">+</span> <span class="s1">&#39;=&#39;</span> <span class="o">+</span> <span class="nx">eUC</span><span class="o">(</span><span class="nx">v</span><span class="o">)</span> <span class="o">+</span> <span class="s1">&#39;&amp;&#39;</span><span class="o">;</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="o">}</span>
<span class="nx">Y</span><span class="o">.</span><span class="nx">log</span><span class="o">(</span><span class="s1">&#39;HTML form serialized. The value is: &#39;</span> <span class="o">+</span> <span class="nx">str</span><span class="o">.</span><span class="nx">substr</span><span class="o">(</span><span class="m">0</span><span class="o">,</span> <span class="nx">str</span><span class="o">.</span><span class="nx">length</span> <span class="o">-</span> <span class="m">1</span><span class="o">),</span> <span class="s1">&#39;info&#39;</span><span class="o">,</span> <span class="s1">&#39;io&#39;</span><span class="o">);</span>
<span class="k">return</span> <span class="nx">str</span><span class="o">.</span><span class="nx">substr</span><span class="o">(</span><span class="m">0</span><span class="o">,</span> <span class="nx">str</span><span class="o">.</span><span class="nx">length</span> <span class="o">-</span> <span class="m">1</span><span class="o">);</span>
<span class="o">};</span>
<span class="nx">_io</span><span class="o">.</span><span class="nx">xdrReady</span> <span class="o">=</span> <span class="nx">_ioXdrReady</span><span class="o">;</span>
<span class="nx">_io</span><span class="o">.</span><span class="nx">start</span> <span class="o">=</span> <span class="nx">_ioStart</span><span class="o">;</span>
<span class="nx">_io</span><span class="o">.</span><span class="nx">success</span> <span class="o">=</span> <span class="nx">_ioSuccess</span><span class="o">;</span>
<span class="nx">_io</span><span class="o">.</span><span class="nx">failure</span> <span class="o">=</span> <span class="nx">_ioFailure</span><span class="o">;</span>
<span class="nx">_io</span><span class="o">.</span><span class="nx">abort</span> <span class="o">=</span> <span class="nx">_ioAbort</span><span class="o">;</span>
<span class="c">//--------------------------------------</span>
<span class="c"></span> <span class="c">// Begin public interface definition</span>
<span class="c"></span> <span class="c">//--------------------------------------</span>
<span class="c"></span> <span class="c">/**</span>
<span class="c"> * @description Method that stores default client headers for all transactions.</span>
<span class="c"> * If a label is passed with no value argument, the header will be deleted.</span>
<span class="c"> * This is the interface for _setHeader().</span>
<span class="c"> *</span>
<span class="c"> * @method header</span>
<span class="c"> * @public</span>
<span class="c"> * @static</span>
<span class="c"> * @param {string} l - HTTP header</span>
<span class="c"> * @param {string} v - HTTP header value</span>
<span class="c"> * @return int</span>
<span class="c"> */</span>
<span class="nx">_io</span><span class="o">.</span><span class="nx">header</span> <span class="o">=</span> <span class="nx">_setHeader</span><span class="o">;</span>
<span class="c">/**</span>
<span class="c"> * @description Method for specifying and initializing a transport</span>
<span class="c"> * to facilitate cross-domain HTTP requests. This is the</span>
<span class="c"> * interface for _initTransport</span>
<span class="c"> *</span>
<span class="c"> * @method transport</span>
<span class="c"> * @public</span>
<span class="c"> * @static</span>
<span class="c"> * @param {object} t - configuration object for the transport.</span>
<span class="c"> * @return boolean</span>
<span class="c"> */</span>
<span class="nx">_io</span><span class="o">.</span><span class="nx">transport</span> <span class="o">=</span> <span class="nx">_initTransport</span><span class="o">;</span>
<span class="c">/**</span>
<span class="c"> * @description Method for requesting a transaction, and queueing the</span>
<span class="c"> * request before it is sent to the resource. This is the</span>
<span class="c"> * interface for _queue().</span>
<span class="c"> *</span>
<span class="c"> * @method queue</span>
<span class="c"> * @public</span>
<span class="c"> * @static</span>
<span class="c"> * @param {string} uri - qualified path to transaction resource.</span>
<span class="c"> * @param {object} c - configuration object for the transaction.</span>
<span class="c"> * @return int</span>
<span class="c"> */</span>
<span class="nx">_io</span><span class="o">.</span><span class="nx">queue</span> <span class="o">=</span> <span class="nx">_queue</span><span class="o">;</span>
<span class="c">/**</span>
<span class="c"> * @description Method to query the current size of the queue, or to</span>
<span class="c"> * set a maximum queue size. This is the interface for _size().</span>
<span class="c"> *</span>
<span class="c"> * @method size</span>
<span class="c"> * @public</span>
<span class="c"> * @static</span>
<span class="c"> * @param {number} i - Specified maximum size of queue.</span>
<span class="c"> * @return number</span>
<span class="c"> */</span>
<span class="nx">_io</span><span class="o">.</span><span class="nx">queue</span><span class="o">.</span><span class="nx">size</span> <span class="o">=</span> <span class="nx">_size</span><span class="o">;</span>
<span class="c">/**</span>
<span class="c"> * @description Method for setting the queue to &quot;active&quot;. If there are</span>
<span class="c"> * transactions pending in the queue, they will be processed from the</span>
<span class="c"> * queue in FIFO order. This is the interface for _start().</span>
<span class="c"> *</span>
<span class="c"> * @method start</span>
<span class="c"> * @public</span>
<span class="c"> * @static</span>
<span class="c"> * @return void</span>
<span class="c"> */</span>
<span class="nx">_io</span><span class="o">.</span><span class="nx">queue</span><span class="o">.</span><span class="nx">start</span> <span class="o">=</span> <span class="nx">_start</span><span class="o">;</span>
<span class="c">/**</span>
<span class="c"> * @description Method for setting queue processing to inactive.</span>
<span class="c"> * Transaction requests to YUI.io.queue() will be stored in the queue, but</span>
<span class="c"> * not processed until the queue is set to &quot;active&quot;. This is the</span>
<span class="c"> * interface for _stop().</span>
<span class="c"> *</span>
<span class="c"> * @method stop</span>
<span class="c"> * @public</span>
<span class="c"> * @static</span>
<span class="c"> * @return void</span>
<span class="c"> */</span>
<span class="nx">_io</span><span class="o">.</span><span class="nx">queue</span><span class="o">.</span><span class="nx">stop</span> <span class="o">=</span> <span class="nx">_stop</span><span class="o">;</span>
<span class="c">/**</span>
<span class="c"> * @description Method for promoting a transaction to the top of the queue.</span>
<span class="c"> * This is the interface for _unshift().</span>
<span class="c"> *</span>
<span class="c"> * @method promote</span>
<span class="c"> * @public</span>
<span class="c"> * @static</span>
<span class="c"> * @param {number} i - ID of queued transaction.</span>
<span class="c"> * @return void</span>
<span class="c"> */</span>
<span class="nx">_io</span><span class="o">.</span><span class="nx">queue</span><span class="o">.</span><span class="nx">promote</span> <span class="o">=</span> <span class="nx">_unshift</span><span class="o">;</span>
<span class="c">/**</span>
<span class="c"> * @description Method for removing a specific, pending transaction from</span>
<span class="c"> * the queue. This is the interface for _purge().</span>
<span class="c"> *</span>
<span class="c"> * @method purge</span>
<span class="c"> * @public</span>
<span class="c"> * @static</span>
<span class="c"> * @param {number} i - ID of queued transaction.</span>
<span class="c"> * @return void</span>
<span class="c"> */</span>
<span class="nx">_io</span><span class="o">.</span><span class="nx">queue</span><span class="o">.</span><span class="nx">purge</span> <span class="o">=</span> <span class="nx">_purge</span><span class="o">;</span>
<span class="c">/**</span>
<span class="c"> * @description Method for requesting a transaction. This</span>
<span class="c"> * is the interface for _io().</span>
<span class="c"> *</span>
<span class="c"> * @method io</span>
<span class="c"> * @public</span>
<span class="c"> * @static</span>
<span class="c"> * @param {string} uri - qualified path to transaction resource.</span>
<span class="c"> * @param {object} c - configuration object for the transaction.</span>
<span class="c"> * @return object</span>
<span class="c"> */</span>
<span class="nx">Y</span><span class="o">.</span><span class="nx">io</span> <span class="o">=</span> <span class="nx">_io</span><span class="o">;</span>
<span class="o">},</span> <span class="s2">&quot;3.0.0&quot;</span><span class="o">);</span>
</pre></div>
</div>
</div>
</div>
<div class="yui-b">
<div class="nav">
<div class="module">
<h4>Modules</h4>
<ul class="content">
<li class=""><a href="module_anim.html">anim</a></li>
<li class=""><a href="module_anim-color.html">anim-color</a></li>
<li class=""><a href="module_anim-curve.html">anim-curve</a></li>
<li class=""><a href="module_anim-easing.html">anim-easing</a></li>
<li class=""><a href="module_anim-scroll.html">anim-scroll</a></li>
<li class=""><a href="module_anim-xy.html">anim-xy</a></li>
<li class=""><a href="module_attribute.html">attribute</a></li>
<li class=""><a href="module_base.html">base</a></li>
<li class=""><a href="module_dd-plugin.html">dd-plugin</a></li>
<li class=""><a href="module_event.html">event</a></li>
<li class=""><a href="module_get.html">get</a></li>
<li class="selected"><a href="module_io.html">io</a></li>
<li class=""><a href="module_loader.html">loader</a></li>
<li class=""><a href="module_node.html">node</a></li>
<li class=""><a href="module_node-class.html">node-class</a></li>
<li class=""><a href="module_node-region.html">node-region</a></li>
<li class=""><a href="module_node-screen.html">node-screen</a></li>
<li class=""><a href="module_Queue.html">Queue</a></li>
<li class=""><a href="module_yui.html">yui</a></li>
</ul>
</div>
<div class="module">
<h4>Classes</h4>
<ul class="content">
<li class=""><a href="io.html">io</a></li>
</ul>
</div>
<div class="module">
<h4>Files</h4>
<ul class="content">
<li class="selected"><a href="io.js.html">io.js</a></li>
</ul>
</div>
</div>
</div>
</div>
<div id="ft">
<hr />
Copyright &copy; 2008 Yahoo! Inc. All rights reserved.
</div>
</div>
</body>
</html>