]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - include/javascript/yui3/build/io/io-queue.js
Release 6.2.0beta4
[Github/sugarcrm.git] / include / javascript / yui3 / build / io / io-queue.js
1 /*
2  Copyright (c) 2009, Yahoo! Inc. All rights reserved.
3  Code licensed under the BSD License:
4  http://developer.yahoo.net/yui/license.txt
5  version: 3.0.0
6  build: 1549
7  */
8 YUI.add('io-queue',function(Y){var _q=new Y.Queue(),_e,_activeId,_qState=1;function _queue(uri,c){var o={uri:uri,id:Y.io._id(),cfg:c};_q.add(o);if(_qState===1){_shift();}
9 return o;}
10 function _shift(){var o=_q.next();_activeId=o.id;_qState=0;Y.io(o.uri,o.cfg,o.id);}
11 function _unshift(o){_q.promote(o);}
12 function _next(id){_qState=1;if(_activeId===id&&_q.size()>0){_shift();}}
13 function _remove(o){_q.remove(o);}
14 function _start(){_qState=1;if(_q.size()>0){_shift();}}
15 function _stop(){_qState=0;};function _size(){return _q.size();};_e=Y.on('io:complete',function(id){_next(id);},Y.io);_queue.size=_size;_queue.start=_start;_queue.stop=_stop;_queue.promote=_unshift;_queue.remove=_remove;Y.mix(Y.io,{queue:_queue},true);},'3.0.0',{requires:['io-base','queue-promote']});