If x
is a thenable it is first assimilated into a promise.
If x
is a Promise
instance or a thenable, the clock won't start running
until it has fulfilled. The returned promise will be fulfilled with the same
value, or x
if it was not a Promise
instance or thenable.
If x
rejects, the returned promise will be rejected with the same rejection
reason. Note that the rejection propagation is not delayed.
To start the clock straight away, without waiting for x
to be fulfilled,
you could use:
delay(5000).yield(promise)
If x
is neither a Promise
instance or a thenable, the returned promise
is fulfilled immediately.
If x
is a thenable it is first assimilated into a promise.
If the promise fulfills or rejects before milliseconds
have passed, the
returned promise is fulfilled or rejected with the same value or reason,
respectively. Otherwise the returned promise is rejected with a
TimeoutError
instance.
timed
Provides helper methods for delaying fulfillment and guarding against indefinitely pending promises or thenables.