~loggerhead-team/loggerhead/trunk-rich

« back to all changes in this revision

Viewing changes to loggerhead/static/javascript/yui/build/io/io-xdr-debug.js

  • Committer: Matt Nordhoff
  • Date: 2010-02-26 04:37:13 UTC
  • mfrom: (400 trunk)
  • mto: This revision was merged to the branch mainline in revision 401.
  • Revision ID: mnordhoff@mattnordhoff.com-20100226043713-7mw3r6dr9qowutmi
Merge trunk for NEWS

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
Copyright (c) 2008, Yahoo! Inc. All rights reserved.
 
3
Code licensed under the BSD License:
 
4
http://developer.yahoo.net/yui/license.txt
 
5
version: 3.0.0pr2
 
6
*/
 
7
YUI.add('io-xdr', function(Y) {
 
8
 
 
9
   /*
 
10
    * Extends the IO base class to provide an alternate, Flash transport, for making
 
11
    * cross-domain requests.
 
12
        * @module io-base
 
13
        * @submodule io-xdr
 
14
        */
 
15
 
 
16
   /**
 
17
        * @event io:xdrReady
 
18
        * @description This event is fired by YUI.io when the specified transport is
 
19
        * ready for use.
 
20
        * @type Event Custom
 
21
        */
 
22
        var E_XDR_READY = 'io:xdrReady';
 
23
 
 
24
   /**
 
25
        * @description Method that creates the Flash transport swf.
 
26
        *
 
27
        * @method _swf
 
28
        * @private
 
29
        * @static
 
30
        * @param {string} uri - location of IO.swf.
 
31
        * @param {string} yid - YUI instance id.
 
32
        * @return void
 
33
        */
 
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">' +
 
39
                              '</object>';
 
40
                Y.get('body').appendChild(Y.Node.create(XDR_SWF))
 
41
        };
 
42
 
 
43
    Y.mix(Y.io, {
 
44
 
 
45
           /**
 
46
                * @description Map of IO transports.
 
47
                *
 
48
                * @property _transportMap
 
49
                * @private
 
50
                * @static
 
51
                * @type object
 
52
                */
 
53
                _transportMap: {},
 
54
 
 
55
           /**
 
56
                * @description Object that stores callback handlers for cross-domain requests
 
57
                * when using Flash as the transport.
 
58
                *
 
59
                * @property _fn
 
60
                * @private
 
61
                * @static
 
62
                * @type object
 
63
                */
 
64
                _fn: {},
 
65
 
 
66
           /**
 
67
                * @description Method for accessing the transport's interface for making a
 
68
                * cross-domain transaction.
 
69
                *
 
70
                * @method _xdr
 
71
                * @private
 
72
                * @static
 
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.
 
76
                * @return object
 
77
                */
 
78
                _xdr: function(uri, o, c){
 
79
                        if (c.on) {
 
80
                                this._fn[o.id] = c.on;
 
81
                        }
 
82
                        o.c.send(uri, c, o.id);
 
83
 
 
84
                        return o;
 
85
                },
 
86
 
 
87
 
 
88
           /**
 
89
                * @description Fires event "io:xdrReady"
 
90
                *
 
91
                * @method xdrReady
 
92
                * @private
 
93
                * @static
 
94
                * @param {number} id - transaction id
 
95
                * @param {object} c - configuration object for the transaction.
 
96
                *
 
97
                * @return void
 
98
                */
 
99
                xdrReady: function(id) {
 
100
                        Y.fire(E_XDR_READY, id);
 
101
                },
 
102
 
 
103
           /**
 
104
                * @description Method to initialize the desired transport.
 
105
                *
 
106
                * @method transport
 
107
                * @public
 
108
                * @static
 
109
                * @param {object} o - object of transport configurations.
 
110
                * @return void
 
111
                */
 
112
                transport: function(o) {
 
113
                        switch (o.id) {
 
114
                                case 'flash':
 
115
                                        _swf(o.src, o.yid);
 
116
                                        this._transportMap.flash = Y.config.doc.getElementById('yuiIoSwf');
 
117
                                        break;
 
118
                        }
 
119
                }
 
120
        });
 
121
 
 
122
 
 
123
 
 
124
}, '3.0.0pr2' ,{requires:['io-base']});