API reference@evolu/commonSchedule › delayed

function delayed(
  initialDelay: Duration,
): <Output, Input>(
  schedule: Schedule<Output, Input>,
) => Schedule<Output, Input>;

Defined in: packages/common/src/Schedule.ts:978

Replaces the schedule's first delay.

The first successful step uses initialDelay instead of the delay produced by the schedule. Subsequent steps use the schedule's delays unchanged.

Replacing the first delay

import { assertOk, delayed, exponential, testCreateDeps } from "@evolu/common";

const step = delayed("1s")(exponential("100ms"))(testCreateDeps());
// Only the first delay is replaced; later exponential delays are unchanged.
assertOk(step(undefined), [100, 1000]);
assertOk(step(undefined), [200, 200]);