/usr/share/javascript/yui3/io-queue/io-queue-debug.js is in libjs-yui3-debug 3.5.1-1ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 | /*
YUI 3.5.1 (build 22)
Copyright 2012 Yahoo! Inc. All rights reserved.
Licensed under the BSD License.
http://yuilibrary.com/license/
*/
YUI.add('io-queue', function(Y) {
/**
Extends IO to implement Queue for synchronous
transaction processing.
@module io
@submodule io-queue
@for IO
**/
var io = Y.io._map['io:0'] || new Y.IO();
Y.mix(Y.IO.prototype, {
/**
* Array of transactions queued for processing
*
* @property _q
* @private
* @static
* @type {Object}
*/
_q: new Y.Queue(),
_qActiveId: null,
_qInit: false,
/**
* Property to determine whether the queue is set to
* 1 (active) or 0 (inactive). When inactive, transactions
* will be stored in the queue until the queue is set to active.
*
* @property _qState
* @private
* @static
* @type {Number}
*/
_qState: 1,
/**
* Method Process the first transaction from the
* queue in FIFO order.
*
* @method _qShift
* @private
* @static
*/
_qShift: function() {
var io = this,
o = io._q.next();
io._qActiveId = o.id;
io._qState = 0;
io.send(o.uri, o.cfg, o.id);
},
/**
* Method for queueing a transaction before the request is sent to the
* resource, to ensure sequential processing.
*
* @method queue
* @static
* @return {Object}
*/
queue: function(uri, c) {
var io = this,
o = { uri: uri, cfg:c, id: this._id++ };
if(!io._qInit) {
Y.on('io:complete', function(id, o) { io._qNext(id); }, io);
io._qInit = true;
}
io._q.add(o);
if (io._qState === 1) {
io._qShift();
}
Y.log('Object queued. Transaction id is' + o.id, 'info', 'io');
return o;
},
_qNext: function(id) {
var io = this;
io._qState = 1;
if (io._qActiveId === id && io._q.size() > 0) {
io._qShift();
}
},
/**
* Method for promoting a transaction to the top of the queue.
*
* @method promote
* @static
*/
qPromote: function(o) {
this._q.promote(o);
},
/**
* Method for removing a specific, pending transaction from
* the queue.
*
* @method remove
* @private
* @static
*/
qRemove: function(o) {
this._q.remove(o);
},
qStart: function() {
var io = this;
io._qState = 1;
if (io._q.size() > 0) {
io._qShift();
}
Y.log('Queue started.', 'info', 'io');
},
/**
* Method for setting queue processing to inactive.
* Transaction requests to YUI.io.queue() will be stored in the queue, but
* not processed until the queue is reset to "active".
*
* @method _stop
* @private
* @static
*/
qStop: function() {
this._qState = 0;
Y.log('Queue stopped.', 'info', 'io');
},
/**
* Method to query the current size of the queue.
*
* @method _size
* @private
* @static
* @return {Number}
*/
qSize: function() {
return this._q.size();
}
}, true);
function _queue(u, c) {
return io.queue.apply(io, [u, c]);
}
_queue.start = function () { io.qStart(); };
_queue.stop = function () { io.qStop(); };
_queue.promote = function (o) { io.qPromote(o); };
_queue.remove = function (o) { io.qRemove(o); };
_queue.size = function () { io.qSize(); };
Y.io.queue = _queue;
}, '3.5.1' ,{requires:['io-base','queue-promote']});
|