Hacker News new | ask | show | jobs
by 15155 4079 days ago
A 'timeoutable' promise could be represented as (pseudocode):

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#...