not asynchronous function executed as jQuery Deferred
Lets say I want to process some tasks in the synchronous manner, so I have this function: function executePromiseQueueSync(queue){ var seed = $.Deferred(), finalPromise; finalPromise = _.reduce(queue, function(memo, promise){ return memo.then(function(){ return promise.funct.apply(null, promise.argmnt); }); }, seed.promise()); seed.resolve(); return finalPromise; } Now I can use it to process some files: _.each(fileList, function(element, index, list){ _.each(element, function(el, idx, lst){ promisesQueue.push({funct: processFile, argmnt:[el, index + (len - fileList.length) ,len]}); }); });