Slight (breaking) change to the API
Closed this issue · 5 comments
Since this thing is only 9 hours old, I think we're safe doing it.
When used in this fashion:
promiseFn()
.then(delay(200))
I think it should delay 200ms from the time the first promise resolves.
Why? And not exactly sure how it's different.
See #2.
I think the following should work.
var promise = Promise.resolve('foo').then(delay(200)).then(delay(200));
assert.is(await promise, 'foo'); // after 400 milliseconds. counter starts after promise resolves.
also #3
You're right. This is embarrassing, but I thought .then()
accepted a promise directly too... Would have been so nice if it did.
I thought .then() accepted a promise directly too
When I saw your code I said "Awesome, I didn't know you could do that!".. Turns out you can't 😞
Even if it did, in that case promise.then(delay(200))
ends up meaning "wait for for promise or 200ms - whichever is longer", instead of "wait for promise, then wait 200ms". I like what we have now.