|
@ -27,14 +27,14 @@ var QWeb = core.qweb; |
|
|
|
|
|
|
|
|
var syncLoop = function(items, func, callback) { |
|
|
var syncLoop = function(items, func, callback) { |
|
|
items.reduce(function(promise, item) { |
|
|
items.reduce(function(promise, item) { |
|
|
return promise.then(func); |
|
|
|
|
|
|
|
|
return promise.then(func.bind(this, item)); |
|
|
}, $.Deferred().resolve()).then(callback); |
|
|
}, $.Deferred().resolve()).then(callback); |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
var syncProgress = function(items, func, callback, update) { |
|
|
var syncProgress = function(items, func, callback, update) { |
|
|
var progress = 0; |
|
|
var progress = 0; |
|
|
items.reduce(function(promise, item) { |
|
|
items.reduce(function(promise, item) { |
|
|
return promise.then(function() { |
|
|
|
|
|
|
|
|
return promise.done(function() { |
|
|
update(++progress / items.length); |
|
|
update(++progress / items.length); |
|
|
return func(item); |
|
|
return func(item); |
|
|
}); |
|
|
}); |
|
|