[API reference](https://evolu.dev/docs/api-reference) › [@evolu/common](https://evolu.dev/docs/api-reference/common) › [Schedule](https://evolu.dev/docs/api-reference/common/Schedule) › collectWhileScheduleOutput

```ts
function collectWhileScheduleOutput<Output>(
  predicate: Predicate<Output>,
): <Input>(
  schedule: Schedule<Output, Input>,
) => Schedule<readonly Output[], Input>;
```

Defined in: [packages/common/src/Schedule.ts:1196](https://github.com/evoluhq/evolu/blob/e7144e2bbe9069362b62dec1b64a8aa922b8f1b0/packages/common/src/Schedule.ts#L1196)

Collects outputs while a predicate is true.

More flexible than [collectAllScheduleOutputs](https://evolu.dev/docs/api-reference/common/Schedule/functions/collectAllScheduleOutputs) — stops collecting when
the predicate returns false.

### Example

```ts
// Collect delays while under 1 second
const smallDelays = collectWhileScheduleOutput((delay: Millis) => delay < 1000)(
  exponential("100ms"),
);
// Outputs: [100], [100, 200], [100, 200, 400], [100, 200, 400, 800], stops
```