2
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
3
Code licensed under the BSD License:
4
http://developer.yahoo.net/yui/license.txt
7
YUI.add('io-xdr', function(Y) {
10
* Extends the IO base class to provide an alternate, Flash transport, for making
11
* cross-domain requests.
18
* @description This event is fired by YUI.io when the specified transport is
22
var E_XDR_READY = 'io:xdrReady';
25
* @description Method that creates the Flash transport swf.
30
* @param {string} uri - location of IO.swf.
31
* @param {string} yid - YUI instance id.
34
function _swf(uri, yid) {
35
var XDR_SWF = '<object id="yuiIoSwf" type="application/x-shockwave-flash" data="' + uri + '" width="0" height="0">' +
36
'<param name="movie" value="' + uri + '">' +
37
'<param name="FlashVars" value="yid=' + yid + '">' +
38
'<param name="allowScriptAccess" value="sameDomain">' +
40
Y.get('body').appendChild(Y.Node.create(XDR_SWF))
46
* @description Map of IO transports.
48
* @property _transportMap
56
* @description Object that stores callback handlers for cross-domain requests
57
* when using Flash as the transport.
67
* @description Method for accessing the transport's interface for making a
68
* cross-domain transaction.
73
* @param {string} uri - qualified path to transaction resource.
74
* @param {object} o - Transaction object generated by _create() in io-base.
75
* @param {object} c - configuration object for the transaction.
78
_xdr: function(uri, o, c){
80
this._fn[o.id] = c.on;
82
o.c.send(uri, c, o.id);
89
* @description Fires event "io:xdrReady"
94
* @param {number} id - transaction id
95
* @param {object} c - configuration object for the transaction.
99
xdrReady: function(id) {
100
Y.fire(E_XDR_READY, id);
104
* @description Method to initialize the desired transport.
109
* @param {object} o - object of transport configurations.
112
transport: function(o) {
116
this._transportMap.flash = Y.config.doc.getElementById('yuiIoSwf');
124
}, '3.0.0pr2' ,{requires:['io-base']});