This is a helper function that returns a promise after a delay. It can be used with any pipe and any object (see examples).
wait(x, delay = 0)
x | An object. |
---|---|
delay | Number of seconds before resolving the promise. |
A promise. See details for the value of the fulfilled promise.
The value of the returned promise depends on the class of x
. If x
can
be coerced to a promise (using
promises::as.promise()), the value of the returned
promise is identical to the value of promises::as.promise(x)
once
fulfilled; otherwise the value of the returned promise is x
after the
delay.