Merge "Set visibility on class properties of UnregisteredLocalFile"
[lhc/web/wiklou.git] / resources / jquery / jquery.async.js
index f5de326..2161f6b 100644 (file)
 // opts.test : (default true) function to test in the while test part
 // opts.loop : (default empty) function to call in the while loop part
 // opts.end : (default empty) function to call at the end of the while loop
-$.whileAsync = function(opts)
-{
+$.whileAsync = function(opts) {
        var delay = Math.abs(opts.delay) || 10,
                bulk = isNaN(opts.bulk) ? 500 : Math.abs(opts.bulk),
                test = opts.test || function(){ return true; },
                loop = opts.loop || function(){},
-               end  = opts.end  || function(){};
+               end = opts.end || function(){};
        
        (function(){
 
                var t = false,
                        begin = new Date();
                        
-               while( t = test() )
-               {
+               while( t = test() ) {
                        loop();
-                       if( bulk === 0 || (new Date() - begin) > bulk )
-                       {
+                       if( bulk === 0 || (new Date() - begin) > bulk ) {
                                break;
                        }
                }
-               if( t )
-               {
+               if( t ) {
                        setTimeout(arguments.callee, delay);
                }
-               else
-               {
+               else {
                        end();
                }
                
        })();
-}
+};
 
 // opts.delay : (default 10) delay between async call in ms
 // opts.bulk : (default 500) delay during which the loop can continue synchronously without yielding the CPU
 // opts.loop : (default empty) function to call in the each loop part, signature: function(index, value) this = value
 // opts.end : (default empty) function to call at the end of the each loop
-$.eachAsync = function(array, opts)
-{
-       var i = 0,
+$.eachAsync = function(array, opts) {
+       var     i = 0,
                l = array.length,
                loop = opts.loop || function(){};
        
        $.whileAsync(
                $.extend(opts, {
-                       test: function(){ return i < l; },
-                       loop: function()
-                       {
+                       test: function() { return i < l; },
+                       loop: function() {
                                var val = array[i];
                                return loop.call(val, i++, val);
                        }
                })
        );
-}
+};
 
-$.fn.eachAsync = function(opts)
-{
+$.fn.eachAsync = function(opts) {
        $.eachAsync(this, opts);
        return this;
 }
 
-})(jQuery);
-
+})(jQuery);
\ No newline at end of file