diff -r 322d0feea350 -r 89ef5ed3c48b src/cm/media/js/lib/yui/yui_3.10.3/build/datasource-io/datasource-io.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/cm/media/js/lib/yui/yui_3.10.3/build/datasource-io/datasource-io.js Tue Jul 16 14:29:46 2013 +0200 @@ -0,0 +1,208 @@ +/* +YUI 3.10.3 (build 2fb5187) +Copyright 2013 Yahoo! Inc. All rights reserved. +Licensed under the BSD License. +http://yuilibrary.com/license/ +*/ + +YUI.add('datasource-io', function (Y, NAME) { + +/** + * Provides a DataSource implementation which can be used to retrieve data via the IO Utility. + * + * @module datasource + * @submodule datasource-io + */ + +/** + * IO subclass for the DataSource Utility. + * @class DataSource.IO + * @extends DataSource.Local + * @constructor + */ +var DSIO = function() { + DSIO.superclass.constructor.apply(this, arguments); +}; + + + ///////////////////////////////////////////////////////////////////////////// + // + // DataSource.IO static properties + // + ///////////////////////////////////////////////////////////////////////////// +Y.mix(DSIO, { + /** + * Class name. + * + * @property NAME + * @type String + * @static + * @final + * @value "dataSourceIO" + */ + NAME: "dataSourceIO", + + + ///////////////////////////////////////////////////////////////////////////// + // + // DataSource.IO Attributes + // + ///////////////////////////////////////////////////////////////////////////// + + ATTRS: { + /** + * Pointer to IO Utility. + * + * @attribute io + * @type Y.io + * @default Y.io + */ + io: { + value: Y.io, + cloneDefaultValue: false + }, + + /** + * Default IO Config. + * + * @attribute ioConfig + * @type Object + * @default null + */ + ioConfig: { + value: null + } + } +}); + +Y.extend(DSIO, Y.DataSource.Local, { + /** + * Internal init() handler. + * + * @method initializer + * @param config {Object} Config object. + * @private + */ + initializer: function(config) { + this._queue = {interval:null, conn:null, requests:[]}; + }, + + /** + * IO success callback. + * + * @method successHandler + * @param id {String} Transaction ID. + * @param response {String} Response. + * @param e {Event.Facade} Event facade. + * @private + */ + successHandler: function (id, response, e) { + var defIOConfig = this.get("ioConfig"), + payload = e.details[0]; + + delete Y.DataSource.Local.transactions[e.tId]; + + payload.data = response; + this.fire("data", payload); + + + if (defIOConfig && defIOConfig.on && defIOConfig.on.success) { + defIOConfig.on.success.apply(defIOConfig.context || Y, arguments); + } + }, + + /** + * IO failure callback. + * + * @method failureHandler + * @param id {String} Transaction ID. + * @param response {String} Response. + * @param e {Event.Facade} Event facade. + * @private + */ + failureHandler: function (id, response, e) { + var defIOConfig = this.get("ioConfig"), + payload = e.details[0]; + + delete Y.DataSource.Local.transactions[e.tId]; + + payload.error = new Error("IO data failure"); + + payload.data = response; + this.fire("data", payload); + + + if (defIOConfig && defIOConfig.on && defIOConfig.on.failure) { + defIOConfig.on.failure.apply(defIOConfig.context || Y, arguments); + } + }, + + /** + * @property _queue + * @description Object literal to manage asynchronous request/response + * cycles enabled if queue needs to be managed (asyncMode/ioConnMode): + *
response event when
+ * response is received asynchronously.
+ *
+ * @method _defRequestFn
+ * @param e {Event.Facade} Event Facade with the following properties:
+ *