f the rejection handling of the `bluebird` utility
functions `Promise.some()` and `Promise.any()`. I considered them for
`prfun` and decided that I didn't want to support this API.
Note also that the matter of merging/reporting all the rejections is
awkward; `bluebird` uses a new `AggregateE
kup and
> racing it against the network, you want to display the data from whichever
> source resolves first, and only display a fallback resource when neither
> the cache nor the network are available.
>
> In the same thread, [Tab Atkins mentioned][2] `Promise.any` fulfills this
> u
On Thu, Jul 17, 2014 at 1:41 PM, Tab Atkins Jr. wrote:
>
> Nope, that'll accept with `undefined` if the first settled promise is
> rejected. ^_^ This is non-trivial to do correctly; you need to have
Fixed:
```
Promise.any = function(promises) {
var errors = [];
retur
d add before `Promise.any`.
>
> Here's a very short implementation of `Promise.any`:
> ```
> Promise.any = function(promises) {
> var errors = [];
> return Promise.race(promises.map(function(p) {
> return p.catch(function(e) { errors.push(e); if (errors.len
kup and racing
> it against the network, you want to display the data from whichever source
> resolves first, and only display a fallback resource when neither the cache
> nor the network are available.
>
> In the same thread, [Tab Atkins mentioned][2] `Promise.any` fulfills this
> u
before being added
> to the spec. There are lots of useful methods on Promise which I
> would add before `Promise.any`.
>
> Here's a very short implementation of `Promise.any`:
> ```
> Promise.any = function(promises) {
> var errors = [];
> return Promise.race(promi
I would think that proposed additions to the Promise spec ought to be
prototyped in something like `prfun` or `bluebird` before being added
to the spec. There are lots of useful methods on Promise which I
would add before `Promise.any`.
Here's a very short implementation of `Promis
ither
the cache nor the network are available.
In the same thread, [Tab Atkins mentioned][2] `Promise.any` fulfills this
use case and was briefly discussed within TC39 before being abandoned.
I'd imagine a pseudo implementation would look something like the below,
though you might want to s
8 matches
Mail list logo