PageSourceSearch

https://www.mojakomunita.sk/html/js/aui/io-base/io-base.js?t=1733813117000

js mojakomunita.sk collected 2026-10-01 11:56:40 UTC 28,281 bytes, 842 lines download raw bytes

1/*
2Copyright (c) 2010, Yahoo! Inc. All rights reserved.
3Code licensed under the BSD License:
4http://developer.yahoo.com/yui/license.html
5version: 3.4.0
6build: nightly
7*/
8YUI.add('io-base', function(Y) {
9
10/**
11Base IO functionality. Provides basic XHR transport support.
12@module io-base
13@main io-base
14@for IO
15**/
16
17var isNumber = Y.Lang.isNumber,
18    isObject = Y.Lang.isObject,
19
20    // List of events that comprise the IO event lifecycle.
21    EVENTS = ['start', 'complete', 'end', 'success', 'failure'],
22
23    // Whitelist of used XHR response object properties.
24    XHR_PROPS = ['status', 'statusText', 'responseText', 'responseXML'],
25
26    win = Y.config.win,
27    NativeXHR = win.XMLHttpRequest,
28    NativeXDR = win.XDomainRequest,
29    uid = 0;
30
31/**
32The IO class is a utility that brokers HTTP requests through a simplified
33interface.  Specifically, it allows JavaScript to make HTTP requests to
34a resource without a page reload.  The underlying transport for making
35same-domain requests is the XMLHttpRequest object.  IO can also use
36Flash, if specified as a transport, for cross-domain requests.
37
38@class IO
39@constructor
40@param {Object} config Object of EventTarget's publish method configurations
41                    used to configure IO's events.
42**/
43function IO (config) {
44    var io = this;
45
46    io._uid = 'io:' + uid++;
47    io._init(config);
48    Y.io._map[io._uid] = io;
49}
50
51IO.prototype = {
52    //--------------------------------------
53    //  Properties
54    //--------------------------------------
55
56   /**
57    * A counter that increments for each transaction.
58    *
59    * @property _id
60    * @private
61    * @type {Number}
62    */
63    _id: 0,
64
65   /**
66    * Object of IO HTTP headers sent with each transaction.
67    *
68    * @property _headers
69    * @private
70    * @type {Object}
71    */
72    _headers: {
73        'X-Requested-With' : 'XMLHttpRequest'
74    },
75
76   /**
77    * Object that stores timeout values for any transaction with a defined
78    * "timeout" configuration property.
79    *
80    * @property _timeout
81    * @private
82    * @type {Object}
83    */
84    _timeout: {},
85
86    //--------------------------------------
87    //  Methods
88    //--------------------------------------
89
90    _init: function(config) {
91        var io = this, i;
92        
93        io.cfg = config || {};
94
95        Y.augment(io, Y.EventTarget);
96        for (i = 0; i < 5; i++) {
97            // Publish IO global events with configurations, if any.
98            // IO global events are set to broadcast by default.
99            // These events use the "io:" namespace.
100            io.publish('io:' + EVENTS[i], Y.merge({ broadcast: 1 }, config));
101            // Publish IO transaction events with configurations, if
102            // any.  These events use the "io-trn:" namespace.
103            io.publish('io-trn:' + EVENTS[i], config);
104        }
105    },
106
107   /**
108    * Method that creates a unique transaction object for each request.
109    *
110    * @method _create
111    * @private
112    * @param {Object} config Configuration object subset to determine if
113    *                 the transaction is an XDR or file upload,
114    *                 requiring an alternate transport.
115    * @param {Number} id Transaction id
116    * @return {Object} The transaction object
117    */
118    _create: function(config, id) {
119        var io = this,
120            transaction = {
121                id : isNumber(id) ? id : io._id++,
122                uid: io._uid
123            },
124            xdrConfig = config.xdr,
125            use = xdrConfig && xdrConfig.use,
126            ie  = (xdrConfig && xdrConfig.use === 'native' && NativeXDR),
127            transport = io._transport;
128
129        if (!use) {
130            use = (config.form && config.form.upload) ? 'iframe' : 'xhr';
131        }
132
133        switch (use) {
134            case 'native':
135            case 'xhr':
136                transaction.c = ie ?
137                    new NativeXDR() :
138                    NativeXHR ?
139                        new NativeXHR() :
140                        new ActiveXObject('Microsoft.XMLHTTP');
141                transaction.t =  ie ? true : false;
142                break;
143            default:
144                transaction.c = (transport && transport[use]) || {};
145                transaction.t = true;
146        }
147
148        return transaction;
149    },
150
151    _destroy: function(transaction) {
152        if (win && !transaction.t) {
153            if (NativeXHR) {
154                transaction.c.onreadystatechange = null;
155            } else if (Y.UA.ie && !transaction.e) {
156                // IE, when using XMLHttpRequest as an ActiveX Object, will throw
157                // a "Type Mismatch" error if the event handler is set to "null".
158                transaction.c.abort();
159            }
160        }
161
162        transaction = transaction.c = null;
163    },
164
165   /**
166    * Method for creating and firing events.
167    *
168    * @method _evt
169    * @private
170    * @param {String} eventName Event to be published.
171    * @param {Object} transaction Transaction object.
172    * @param {Object} config Configuration data subset for event subscription.
173    */
174    _evt: function(eventName, transaction, config) {
175        var io          = this, params,
176            args        = config['arguments'],
177            emitFacade  = io.cfg.emitFacade,
178            globalEvent = "io:" + eventName,
179            trnEvent    = "io-trn:" + eventName;
180
181        if (transaction.e) { 
182            transaction.c = { status: 0, statusText: transaction.e };
183        }
184
185        // Fire event with parameters or an Event Facade.
186        params = [(emitFacade) ?
187            {
188                id: transaction.id,
189                data: transaction.c,
190                cfg: config,
191                'arguments': args
192            } :
193            transaction.id
194        ];
195
196        if (!emitFacade) {
197            if (eventName === EVENTS[0] || eventName === EVENTS[2]) {
198                if (args) {
199                    params.push(args);
200                }
201            } else {
202                params.push(transaction.c);
203                if (args) {
204                    params.push(args);
205                }
206            }
207        }
208        
209        params.unshift(globalEvent);
210        // Fire global events.
211        io.fire.apply(io, params);
212        // Fire transaction events, if receivers are defined.
213        if (config.on) {
214            params[0] = trnEvent;
215            io.once(trnEvent, config.on[eventName], config.context || Y);
216            io.fire.apply(io, params);
217        }
218    },
219
220   /**
221    * Fires event "io:start" and creates, fires a transaction-specific
222    * start event, if `config.on.start` is defined.
223    *
224    * @method start
225    * @param {Object} transaction Transaction object.
226    * @param {Object} config Configuration object for the transaction.
227    */
228    start: function(transaction, config) {
229       /**
230        * Signals the start of an IO request.
231        * @event io:start
232        */
233        this._evt(EVENTS[0], transaction, config);
234    },
235
236   /**
237    * Fires event "io:complete" and creates, fires a
238    * transaction-specific "complete" event, if config.on.complete is
239    * defined.
240    *
241    * @method complete
242    * @param {Object} transaction Transaction object.
243    * @param {Object} config Configuration object for the transaction.
244    */
245    complete: function(transaction, config) {
246       /**
247        * Signals the completion of the request-response phase of a
248        * transaction. Response status and data are accessible, if
249        * available, in this event.
250        * @event io:complete
251        */
252        this._evt(EVENTS[1], transaction, config);
253    },
254
255   /**
256    * Fires event "io:end" and creates, fires a transaction-specific "end"
257    * event, if config.on.end is defined.
258    *
259    * @method end
260    * @param {Object} transaction Transaction object.
261    * @param {Object} config Configuration object for the transaction.
262    */
263    end: function(transaction, config) {
264       /**
265        * Signals the end of the transaction lifecycle.
266        * @event io:end
267        */
268        this._evt(EVENTS[2], transaction, config);
269        this._destroy(transaction);
270    },
271
272   /**
273    * Fires event "io:success" and creates, fires a transaction-specific
274    * "success" event, if config.on.success is defined.
275    *
276    * @method success
277    * @param {Object} transaction Transaction object.
278    * @param {Object} config Configuration object for the transaction.
279    */
280    success: function(transaction, config) {
281       /**
282        * Signals an HTTP response with status in the 2xx range.
283        * Fires after io:complete.
284        * @event io:success
285        */
286        this._evt(EVENTS[3], transaction, config);
287        this.end(transaction, config);
288    },
289
290   /**
291    * Fires event "io:failure" and creates, fires a transaction-specific
292    * "failure" event, if config.on.failure is defined.
293    *
294    * @method failure
295    * @param {Object} transaction Transaction object.
296    * @param {Object} config Configuration object for the transaction.
297    */
298    failure: function(transaction, config) {
299       /**
300        * Signals an HTTP response with status outside of the 2xx range.
301        * Fires after io:complete.
302        * @event io:failure
303        */
304        this._evt(EVENTS[4], transaction, config);
305        this.end(transaction, config);
306    },
307
308   /**
309    * Retry an XDR transaction, using the Flash tranport, if the native
310    * transport fails.
311    *
312    * @method _retry
313    * @private
314    * @param {Object} transaction Transaction object.
315    * @param {String} uri Qualified path to transaction resource.
316    * @param {Object} config Configuration object for the transaction.
317    */
318    _retry: function(transaction, uri, config) {
319        this._destroy(transaction);
320        config.xdr.use = 'flash';
321        return this.send(uri, config, transaction.id);
322    },
323
324   /**
325    * Method that concatenates string data for HTTP GET transactions.
326    *
327    * @method _concat
328    * @private
329    * @param {String} uri URI or root data.
330    * @param {String} data Data to be concatenated onto URI.
331    * @return {String}
332    */
333    _concat: function(uri, data) {
334        uri += (uri.indexOf('?') === -1 ? '?' : '&') + data;
335        return uri;
336    },
337
338   /**
339    * Stores default client headers for all transactions. If a label is
340    * passed with no value argument, the header will be deleted.
341    *
342    * @method setHeader
343    * @param {String} name HTTP header
344    * @param {String} value HTTP header value
345    */
346    setHeader: function(name, value) {
347        if (value) {
348            this._headers[name] = value;
349        } else {
350            delete this._headers[name];
351        }
352    },
353
354   /**
355    * Method that sets all HTTP headers to be sent in a transaction.
356    *
357    * @method _setHeaders
358    * @private
359    * @param {Object} transaction - XHR instance for the specific transaction.
360    * @param {Object} headers - HTTP headers for the specific transaction, as
361    *                    defined in the configuration object passed to YUI.io().
362    */
363    _setHeaders: function(transaction, headers) {
364        headers = Y.merge(this._headers, headers);
365        Y.Object.each(headers, function(value, name) {
366            if (value !== 'disable') {
367                transaction.setRequestHeader(name, headers[name]);
368            }
369        });
370    },
371
372   /**
373    * Starts timeout count if the configuration object has a defined
374    * timeout property.
375    *
376    * @method _startTimeout
377    * @private
378    * @param {Object} transaction Transaction object generated by _create().
379    * @param {Object} timeout Timeout in milliseconds.
380    */
381    _startTimeout: function(transaction, timeout) {
382        var io = this;
383
384        io._timeout[transaction.id] = win.setTimeout(function() {
385            io._abort(transaction, 'timeout');
386        }, timeout);
387    },
388
389   /**
390    * Clears the timeout interval started by _startTimeout().
391    *
392    * @method _clearTimeout
393    * @private
394    * @param {Number} id - Transaction id.
395    */
396    _clearTimeout: function(id) {
397        win.clearTimeout(this._timeout[id]);
398        delete this._timeout[id];
399    },
400
401   /**
402    * Method that determines if a transaction response qualifies as success
403    * or failure, based on the response HTTP status code, and fires the
404    * appropriate success or failure events.
405    *
406    * @method _result
407    * @private
408    * @static
409    * @param {Object} transaction Transaction object generated by _create().
410    * @param {Object} config Configuration object passed to io().
411    */
412    _result: function(transaction, config) {
413        var status;
414        // Firefox will throw an exception if attempting to access
415        // an XHR object's status property, after a request is aborted.
416        try {
417            status = transaction.c.status;
418        } catch(e) {
419            status = 0;
420        }
421
422        // IE reports HTTP 204 as HTTP 1223.
423        if (status >= 200 && status < 300 || status === 304 || status === 1223) {
424            this.success(transaction, config);
425        } else {
426            this.failure(transaction, config);
427        }
428    },
429
430   /**
431    * Event handler bound to onreadystatechange.
432    *
433    * @method _rS
434    * @private
435    * @param {Object} transaction Transaction object generated by _create().
436    * @param {Object} config Configuration object passed to YUI.io().
437    */
438    _rS: function(transaction, config) {
439        var io = this;
440
441        if (transaction.c.readyState === 4) {
442            if (config.timeout) {
443                io._clearTimeout(transaction.id);
444            }
445
446            // Yield in the event of request timeout or abort.
447            win.setTimeout(function() {
448                io.complete(transaction, config);
449                io._result(transaction, config);
450            }, 0);
451        }
452    },
453
454   /**
455    * Terminates a transaction due to an explicit abort or timeout.
456    *
457    * @method _abort
458    * @private
459    * @param {Object} transaction Transaction object generated by _create().
460    * @param {String} type Identifies timed out or aborted transaction.
461    */
462    _abort: function(transaction, type) {
463        if (transaction && transaction.c) {
464            transaction.e = type;
465            transaction.c.abort();
466        }
467    },
468
469   /**
470    * Requests a transaction. `send()` is implemented as `Y.io()`.  Each
471    * transaction may include a configuration object.  Its properties are:
472    *
473    * <dl>
474    *   <dt>method</dt>
475    *     <dd>HTTP method verb (e.g., GET or POST). If this property is not
476    *         not defined, the default value will be GET.</dd>
477    *
478    *   <dt>data</dt>
479    *     <dd>This is the name-value string that will be sent as the
480    *     transaction data. If the request is HTTP GET, the data become
481    *     part of querystring. If HTTP POST, the data are sent in the
482    *     message body.</dd>
483    *
484    *   <dt>xdr</dt>
485    *     <dd>Defines the transport to be used for cross-domain requests.
486    *     By setting this property, the transaction will use the specified
487    *     transport instead of XMLHttpRequest. The properties of the
488    *     transport object are:
489    *     <dl>
490    *       <dt>use</dt>
491    *         <dd>The transport to be used: 'flash' or 'native'</dd>
492    *       <dt>dataType</dt>
493    *         <dd>Set the value to 'XML' if that is the expected response
494    *         content type.</dd>
495    *     </dl></dd>
496    *
497    *   <dt>form</dt>
498    *     <dd>Form serialization configuration object.  Its properties are:
499    *     <dl>
500    *       <dt>id</dt>
501    *         <dd>Node object or id of HTML form</dd>
502    *       <dt>useDisabled</dt>
503    *         <dd>`true` to also serialize disabled form field values
504    *         (defaults to `false`)</dd>
505    *     </dl></dd>
506    *
507    *   <dt>on</dt>
508    *     <dd>Assigns transaction event subscriptions. Available events are:
509    *     <dl>
510    *       <dt>start</dt>
511    *         <dd>Fires when a request is sent to a resource.</dd>
512    *       <dt>complete</dt>
513    *         <dd>Fires when the transaction is complete.</dd>
514    *       <dt>success</dt>
515    *         <dd>Fires when the HTTP response status is within the 2xx
516    *         range.</dd>
517    *       <dt>failure</dt>
518    *         <dd>Fires when the HTTP response status is outside the 2xx
519    *         range, if an exception occurs, if the transation is aborted,
520    *         or if the transaction exceeds a configured `timeout`.</dd>
521    *       <dt>end</dt>
522    *         <dd>Fires at the conclusion of the transaction
523    *            lifecycle, after `success` or `failure`.</dd>
524    *     </dl>
525    *
526    *     <p>Callback functions for `start` and `end` receive the id of the
527    *     transaction as a first argument. For `complete`, `success`, and
528    *     `failure`, callbacks receive the id and the response object
529    *     (usually the XMLHttpRequest instance).  If the `arguments`
530    *     property was included in the configuration object passed to
531    *     `Y.io()`, the configured data will be passed to all callbacks as
532    *     the last argument.</p>
533    *     </dd>
534    *
535    *   <dt>sync</dt>
536    *     <dd>Pass `true` to make a same-domain transaction synchronous.
537    *     <strong>CAVEAT</strong>: This will negatively impact the user
538    *     experience. Have a <em>very</em> good reason if you intend to use
539    *     this.</dd>
540    *
541    *   <dt>context</dt>
542    *     <dd>The "`this'" object for all configured event handlers. If a
543    *     specific context is needed for individual callbacks, bind the
544    *     callback to a context using `Y.bind()`.</dd>
545    *
546    *   <dt>headers</dt>
547    *     <dd>Object map of transaction headers to send to the server. The
548    *     object keys are the header names and the values are the header
549    *     values.</dd>
550    *
551    *   <dt>timeout</dt>
552    *     <dd>Millisecond threshold for the transaction before being
553    *     automatically aborted.</dd>
554    *
555    *   <dt>arguments</dt>
556    *     <dd>User-defined data passed to all registered event handlers.
557    *     This value is available as the second argument in the "start" and
558    *     "end" event handlers. It is the third argument in the "complete",
559    *     "success", and "failure" event handlers. <strong>Be sure to quote
560    *     this property name in the transaction configuration as
561    *     "arguments" is a reserved word in JavaScript</strong> (e.g.
562    *     `Y.io({ ..., "arguments": stuff })`).</dd>
563    * </dl>
564    *
565    * @method send
566    * @public
567    * @param {String} uri Qualified path to transaction resource.
568    * @param {Object} config Configuration object for the transaction.
569    * @param {Number} id Transaction id, if already set.
570    * @return {Object}
571    */
572    send: function(uri, config, id) {
573        var transaction, method, i, len, sync, data,
574            io = this,
575            u = uri,
576			response = {};
577
578        config = config ? Y.Object(config) : {};
579        transaction = io._create(config, id);
580        method = config.method ? config.method.toUpperCase() : 'GET';
581        sync = config.sync;
582        data = config.data;
583
584        // Serialize an object into a key-value string using
585        // querystring-stringify-simple.
586        if (isObject(data)) {
587            data = Y.QueryString.stringify(data);
588        }
589
590        if (config.form) {
591            if (config.form.upload) {
592                // This is a file upload transaction, calling
593                // upload() in io-upload-iframe.
594                return io.upload(transaction, uri, config);
595            } else {
596                // Serialize HTML form data into a key-value string.
597                data = io._serialize(config.form, data);
598            }
599        }
600
601        if (data) {
602            switch (method) {
603                case 'GET':
604                case 'HEAD':
605                case 'DELETE':
606                    u = io._concat(u, data);
607                    data = '';
608                    break;
609                case 'POST':
610                case 'PUT':
611                    // If Content-Type is defined in the configuration object, or
612                    // or as a default header, it will be used instead of
613                    // 'application/x-www-form-urlencoded; charset=UTF-8'
614                    config.headers = Y.merge({
615                        'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
616                    }, config.headers);
617                    break;
618            }
619        }
620
621        if (transaction.t) {
622            // Cross-domain request or custom transport configured.
623            return io.xdr(u, transaction, config);
624        }
625
626        if (!sync) {
627            transaction.c.onreadystatechange = function() {
628                io._rS(transaction, config);
629            };
630        }
631
632        try {
633            // Determine if request is to be set as
634            // synchronous or asynchronous.
635            transaction.c.open(method, u, !sync, config.username || null, config.password || null);
636            io._setHeaders(transaction.c, config.headers || {});
637            io.start(transaction, config);
638
639            // Will work only in browsers that implement the
640            // Cross-Origin Resource Sharing draft.
641            if (config.xdr && config.xdr.credentials) {
642                if (!Y.UA.ie) {
643                    transaction.c.withCredentials = true;
644                }
645            }
646
647            // Using "null" with HTTP POST will result in a request
648            // with no Content-Length header defined.
649            transaction.c.send(data);
650
651            if (sync) {
652                // Create a response object for synchronous transactions,
653                // mixing id and arguments properties with the xhr
654                // properties whitelist.
655				for (i = 0, len = XHR_PROPS.length; i < len; ++i) {
656					response[XHR_PROPS[i]] = transaction.c[XHR_PROPS[i]];
657				}
658
659                response.getAllResponseHeaders = function() {
660                    return transaction.c.getAllResponseHeaders();
661                };
662
663                response.getResponseHeader = function(name) {
664                    return transaction.c.getResponseHeader(name);
665                };
666                    
667                io.complete(transaction, config);
668                io._result(transaction, config);
669
670                return response;
671            }
672        } catch(e) {
673            if (transaction.t) {
674                // This exception is usually thrown by browsers
675                // that do not support XMLHttpRequest Level 2.
676                // Retry the request with the XDR transport set
677                // to 'flash'.  If the Flash transport is not
678                // initialized or available, the transaction
679                // will resolve to a transport error.
680                return io._retry(transaction, uri, config);
681            } else {
682                io.complete(transaction, config);
683                io._result(transaction, config);
684            }
685        }
686
687        // If config.timeout is defined, and the request is standard XHR,
688        // initialize timeout polling.
689        if (config.timeout) {
690            io._startTimeout(transaction, config.timeout);
691        }
692
693        return {
694            id: transaction.id,
695            abort: function() {
696                return transaction.c ? io._abort(transaction, 'abort') : false;
697            },
698            isInProgress: function() {
699                return transaction.c ? (transaction.c.readyState % 4) : false;
700            },
701            io: io
702        };
703    }
704};
705
706/**
707Method for initiating an ajax call.  The first argument is the url end
708point for the call.  The second argument is an object to configure the
709transaction and attach event subscriptions.  The configuration object
710supports the following properties:
711
712<dl>
713  <dt>method</dt>
714    <dd>HTTP method verb (e.g., GET or POST). If this property is not
715        not defined, the default value will be GET.</dd>
716
717  <dt>data</dt>
718    <dd>This is the name-value string that will be sent as the
719    transaction data. If the request is HTTP GET, the data become
720    part of querystring. If HTTP POST, the data are sent in the
721    message body.</dd>
722
723  <dt>xdr</dt>
724    <dd>Defines the transport to be used for cross-domain requests.
725    By setting this property, the transaction will use the specified
726    transport instead of XMLHttpRequest. The properties of the
727    transport object are:
728    <dl>
729      <dt>use</dt>
730        <dd>The transport to be used: 'flash' or 'native'</dd>
731      <dt>dataType</dt>
732        <dd>Set the value to 'XML' if that is the expected response
733        content type.</dd>
734    </dl></dd>
735
736  <dt>form</dt>
737    <dd>Form serialization configuration object.  Its properties are:
738    <dl>
739      <dt>id</dt>
740        <dd>Node object or id of HTML form</dd>
741      <dt>useDisabled</dt>
742        <dd>`true` to also serialize disabled form field values
743        (defaults to `false`)</dd>
744    </dl></dd>
745
746  <dt>on</dt>
747    <dd>Assigns transaction event subscriptions. Available events are:
748    <dl>
749      <dt>start</dt>
750        <dd>Fires when a request is sent to a resource.</dd>
751      <dt>complete</dt>
752        <dd>Fires when the transaction is complete.</dd>
753      <dt>success</dt>
754        <dd>Fires when the HTTP response status is within the 2xx
755        range.</dd>
756      <dt>failure</dt>
757        <dd>Fires when the HTTP response status is outside the 2xx
758        range, if an exception occurs, if the transation is aborted,
759        or if the transaction exceeds a configured `timeout`.</dd>
760      <dt>end</dt>
761        <dd>Fires at the conclusion of the transaction
762           lifecycle, after `success` or `failure`.</dd>
763    </dl>
764
765    <p>Callback functions for `start` and `end` receive the id of the
766    transaction as a first argument. For `complete`, `success`, and
767    `failure`, callbacks receive the id and the response object
768    (usually the XMLHttpRequest instance).  If the `arguments`
769    property was included in the configuration object passed to
770    `Y.io()`, the configured data will be passed to all callbacks as
771    the last argument.</p>
772    </dd>
773
774  <dt>sync</dt>
775    <dd>Pass `true` to make a same-domain transaction synchronous.
776    <strong>CAVEAT</strong>: This will negatively impact the user
777    experience. Have a <em>very</em> good reason if you intend to use
778    this.</dd>
779
780  <dt>context</dt>
781    <dd>The "`this'" object for all configured event handlers. If a
782    specific context is needed for individual callbacks, bind the
783    callback to a context using `Y.bind()`.</dd>
784
785  <dt>headers</dt>
786    <dd>Object map of transaction headers to send to the server. The
787    object keys are the header names and the values are the header
788    values.</dd>
789
790  <dt>timeout</dt>
791    <dd>Millisecond threshold for the transaction before being
792    automatically aborted.</dd>
793
794  <dt>arguments</dt>
795    <dd>User-defined data passed to all registered event handlers.
796    This value is available as the second argument in the "start" and
797    "end" event handlers. It is the third argument in the "complete",
798    "success", and "failure" event handlers. <strong>Be sure to quote
799    this property name in the transaction configuration as
800    "arguments" is a reserved word in JavaScript</strong> (e.g.
801    `Y.io({ ..., "arguments": stuff })`).</dd>
802</dl>
803
804@method io
805@static
806@param {String} url qualified path to transaction resource.
807@param {Object} config configuration object for the transaction.
808@return {Object}
809@for YUI
810**/
811Y.io = function(url, config) {
812    // Calling IO through the static interface will use and reuse
813    // an instance of IO.
814    var transaction = Y.io._map['io:0'] || new IO();
815    return transaction.send.apply(transaction, [url, config]);
816};
817
818/**
819Method for setting and deleting IO HTTP headers to be sent with every
820request.
821
822Hosted as a property on the `io` function (e.g. `Y.io.header`).
823
824@method header
825@param {String} name HTTP header
826@param {String} value HTTP header value
827@static
828**/
829Y.io.header = function(name, value) {
830    // Calling IO through the static interface will use and reuse
831    // an instance of IO.
832    var transaction = Y.io._map['io:0'] || new IO();
833    transaction.setHeader(name, value);
834};
835
836Y.IO = IO;
837// Map of all IO instances created.
838Y.io._map = {};
839
840
841
842}, '3.4.0' ,{requires:['event-custom-base', 'querystring-stringify-simple']});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.