3 ms·
A 'timeoutable' promise could be represented as (pseudocode): Promise.any([newTimeout(1000), otherPromise]) where: newTimeout :: Milliseconds -> Promise If
by 15155 12y 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#timeoutint-ms--string-message---promise https://github.com/petkaantonov/bluebird/blob/master/API.md#...