mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[ui/promises] add Promise.race() method to Promises util
This commit is contained in:
parent
1683e03b53
commit
faa7771e12
1 changed files with 7 additions and 0 deletions
|
@ -95,6 +95,13 @@ module.service('Promise', function ($q, $timeout) {
|
|||
});
|
||||
});
|
||||
};
|
||||
Promise.race = function (arr) {
|
||||
return new Promise((resolve, reject) => {
|
||||
arr.forEach(p => {
|
||||
Promise.resolve(p).then(resolve, reject);
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
return Promise;
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue