io-xdr-debug.js revision 35f7824cb38c019cc78d7ea0efeda1f070ede7cf
/**
* Extends the IO base class to provide an alternate, Flash transport, for making
* cross-domain requests.
* @module io
* @submodule io-xdr
*/
/**
* @event io:xdrReady
* @description This event is fired by YUI.io when the specified transport is
* ready for use.
* @type Event Custom
*/
/**
* @description Object that stores callback handlers for cross-domain requests
* when using Flash as the transport.
*
* @property _cB
* @private
* @static
* @type object
*/
_cB = {},
/**
* @description Map of transaction readyState values used when
* XDomainRequest is the XDR transport.
*
* @property _rS
* @private
* @static
* @type object
*/
_rS = {},
// Document reference
// Window reference
// IE8 cross-origin request detection
ie = w && w.XDomainRequest;
/**
* @description Method that creates the Flash transport swf.
*
* @method _swf
* @private
* @static
* @param {string} uri - location of io.swf.
* @param {string} yid - YUI instance id.
* @return void
*/
var o = '<object id="yuiIoSwf" type="application/x-shockwave-flash" data="' +
uri + '" width="0" height="0">' +
'<param name="allowScriptAccess" value="always">' +
'</object>',
c = d.createElement('div');
d.body.appendChild(c);
c.innerHTML = o;
}
/**
* @description Sets event handlers for XDomainRequest transactions.
*
* @method _evt
* @private
* @static
* @param {object} o - Transaction object generated by _create() in io-base.
* @param {object} c - configuration object for the transaction.
* @return void
*/
function _evt(o, c) {
o.c.onload = function() {
};
o.c.onerror = function() {
};
if (c.timeout) {
o.c.ontimeout = function() {
};
}
}
/**
* @description Creates a response object for XDR transactions, for success
* and failure cases.
*
* @method _data
* @private
* @static
* @param {object} o - Transaction object generated by _create() in io-base.
* @param {boolean} f - True if Flash was used as the transport.
* @param {boolean} t - DataType value, as defined in the configuration.
*
* @return object
*/
function _data(o, f, t) {
var s, x;
if (!o.e) {
}
else {
}
}
/**
* @description Method for intiating an XDR transaction abort.
*
* @method _abort
* @private
* @static
* @param {object} o - Transaction object generated by _create() in io-base.
* @param {object} c - configuration object for the transaction.
*/
function _abort(o, c) {
}
/**
* @description Method for determining if an XDR transaction has completed
* and all data are received.
*
* @method _isInProgress.
* @private
* @static
* @param {object} o - Transaction object generated by _create() in io-base.
*/
function _isInProgress(o) {
}
/**
* @description Map of io transports.
*
* @property _transport
* @private
* @static
* @type object
*/
_transport: {},
/**
* @description Method for accessing the transport's interface for making a
* cross-domain transaction.
*
* @method xdr
* @private
* @static
* @param {string} uri - qualified path to transaction resource.
* @param {object} o - Transaction object generated by _create() in io-base.
* @param {object} c - configuration object for the transaction.
*/
};
// These properties cannot be serialized across Flash's
// ExternalInterface. Doing so will result in exceptions.
c.context = null;
c.form = null;
}
else if (ie) {
_evt(o, c);
}
else {
}
return {
abort: function() {
return o.c ? _abort(o, c) : false;
},
isInProgress: function() {
return o.c ? _isInProgress(o.id) : false;
}
};
},
/**
* @description Response controller for cross-domain requests when using the
* Flash transport or IE8's XDomainRequest object.
*
* @method xdrResponse
* @private
* @static
* @param {object} o - Transaction object generated by _create() in io-base.
* @param {object} c - configuration object for the transaction.
* @param {string} e - Event name
* @return object
*/
xdrResponse: function(o, c, e) {
var cb,
if (f) {
if (cb) {
}
}
switch (e.toLowerCase()) {
case 'start':
break;
case 'complete':
break;
case 'success':
delete m[o.id];
break;
case 'timeout':
case 'abort':
case 'failure':
if (e === ('abort' || 'timeout')) {
o.e = e;
}
delete m[o.id];
break;
}
},
/**
* @description Fires event "io:xdrReady"
*
* @method xdrReady
* @private
* @static
* @param {number} id - transaction id
* @param {object} c - configuration object for the transaction.
*
* @return void
*/
},
/**
* @description Method to initialize the desired transport.
*
* @method transport
* @public
* @static
* @param {object} o - object of transport configurations.
* @return void
*/
transport: function(o) {
}
else if (oid) {
}
}
});
/**
* @description Delay value to calling the Flash transport, in the
* event io.swf has not finished loading. Once the E_XDR_READY
* event is fired, this value will be set to 0.
*
* @property _delay
* @public
* @static
* @type number
*/