[Home](./index.md) > [@apextoaster/js-utils](./js-utils.md) > [deferUntil](./js-utils.deferuntil.md)
## deferUntil() function
Resolve if `cb` returns true within `max` tries, otherwise reject with a `TimeoutError`.
Signature:
```typescript
export declare function deferUntil(cb: PredicateC0, step: number, max: number): Promise;
```
## Parameters
| Parameter | Type | Description |
| --- | --- | --- |
| cb | PredicateC0 | |
| step | number | |
| max | number | |
Returns:
Promise<void>
## Exceptions
TimeoutError