Latest updates from IceHrmPro
This commit is contained in:
31
web/node_modules/rc-field-form/es/utils/asyncUtil.js
generated
vendored
Normal file
31
web/node_modules/rc-field-form/es/utils/asyncUtil.js
generated
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
export function allPromiseFinish(promiseList) {
|
||||
var hasError = false;
|
||||
var count = promiseList.length;
|
||||
var results = [];
|
||||
|
||||
if (!promiseList.length) {
|
||||
return Promise.resolve([]);
|
||||
}
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
promiseList.forEach(function (promise, index) {
|
||||
promise.catch(function (e) {
|
||||
hasError = true;
|
||||
return e;
|
||||
}).then(function (result) {
|
||||
count -= 1;
|
||||
results[index] = result;
|
||||
|
||||
if (count > 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (hasError) {
|
||||
reject(results);
|
||||
}
|
||||
|
||||
resolve(results);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user