> ## Documentation Index
> Fetch the complete documentation index at: https://docs.endstate.io/llms.txt
> Use this file to discover all available pages before exploring further.

# poll

> Reads until the predicate accepts. The one polling primitive every waitUntil helper is built on. The signal passed to `read` carries both the caller's cancellation and the remaining budget, so a single slow read cannot outlive the timeout the caller asked for.

```ts theme={null}
poll<T>(read: (signal: AbortSignal) => Promise<T>, until: (value: T) => boolean, options?: PollOptions): Promise<T>
```

## Example

```ts theme={null}
const settled = await poll(
  (signal) => endstate.units.get(unitId, { signal }),
  (unit) => unit.collection?.token.status === "active",
);
```
