API reference@evolu/commonSchedule › linear

function linear(
  base: Duration,
): Schedule<
  number &
    Brand<"NonNaN"> &
    Brand<"Finite"> &
    Brand<"Int"> &
    Brand<"NonNegative"> &
    Brand<"LessThan281474976710655"> &
    Brand<"Millis">
>;

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

Linear backoff schedule.

Delay increases linearly: base * step:

  • Step 1: base
  • Step 2: base * 2
  • Step 3: base * 3
  • ...

Never stops — combine with take or maxElapsed to limit.

Linear growth

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

// 100ms, 200ms, 300ms, 400ms, ...
const step = linear("100ms")(testCreateDeps());
assertOk(step(undefined), [100, 100]);
assertOk(step(undefined), [200, 200]);