whenAsync
Like normal when
, except that this when
will return a promise that resolves when the expression becomes truthy.
Parameters
fn
timeout
(number
): maximum amount of time to wait, before the promise rejects
Returns
- ANY
Promise
for when an observable eventually matches some condition. Rejects if timeout is provided and has expired.
Examples
await whenAsync(() => !state.someBoolean)