[1]: Well, based on comments on HN and Reddit. Not sure about hard numbers, but it certainly gets talked about a lot.
Even the ES6 Promises implementation supports this:
Promise.all([{
then: function(r) {
r(3);
}
}]).then(function(result) {
console.log(result);
});
Here the plain object with then could have been any promise implementation, even jQuery, and it still works.See, for example, the discussion about adding a .any() method to the ES6 promise spec: https://esdiscuss.org/topic/promise-any
The conclusion basically that yes it would be useful, but it'll have to be ES7 not ES6.
The bad news is nobody has actually stepped up to champion such an addition, so it's looking unlikely that such a feature would be implemented in 2 browsers by the mid-2016 deadline necessary for it to be part of ES2016.
Promise.any([newTimeout(1000), otherPromise])
where:
newTimeout :: Milliseconds -> Promise
If the combination of these two isn't already in Promise implementations, it should be.
Bluebird already has the timeout function with similar semantics.
https://github.com/petkaantonov/bluebird/blob/master/API.md#...