API reference@evolu/commonSchedule › modifyDelay

function modifyDelay(
  f: (
    delay: number &
      Brand<"Int"> &
      Brand<"NonNegative"> &
      Brand<"LessThan281474976710655"> &
      Brand<"Millis">,
  ) => number,
): <Output, Input>(
  schedule: Schedule<Output, Input>,
) => Schedule<Output, Input>;

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

Transforms the delay of a schedule.

More flexible than maxDelay — can implement any delay transformation.

Example

// Double all delays
const slower = modifyDelay((d) => d * 2)(exponential("100ms"));

// Cap at 10s (equivalent to maxDelay)
const capped = modifyDelay((d) => Math.min(d, 10000))(exponential("1s"));