View code I want to upload four files, but the upload does not support parallel upload at the moment, so I can only queue, but considering some adjustments to my interface, I can only use synchronization to wait, but it cannot block other threads, so the above Code can only be used.
VaR _ fnlist = [function () {$ ("body"). append (levelfn. Length + ': 1 ');},
Function () {$ ("body"). append (levelfn. Length + '2 ');},
Function () {$ ("body"). append (levelfn. Length + '3 ');},
Function () {$ ("body"). append (levelfn. Length + '4');}];
VaR levelfn = $ (document). Queue ("fnlist", _ fnlist );
// For (VAR I = 0; I <4; I ++ ){
// $ (Document). dequeue ("fnlist ");
//}
VaR BK = function (){
$ (Document). dequeue ("fnlist ");
};
Setinterval (BK, 5000 );
//
// Use a closure to store previous data
VaR _ fnlist = [];
VaR barcode = [];
For (VAR I = 1; I <= 4; I ++ ){
// $ (Document). dequeue ("fnlist ");
// Barcode [I] = I;
_ Fnlist. Push (function (){
VaR temp = I;
VaR EXE = function (){
$ ("Body"). append (levelfn. Length + ':' + temp + "<br/> ");
}
Return EXE;
})());
}
VaR levelfn = $ (document). Queue ("fnlist", _ fnlist );
VaR BK = function (){
$ (Document). dequeue ("fnlist ");
};
Setinterval (BK, 5000 );