pinterval
    Preparing search index...

    Variable durationConst

    duration: {
        cap: (source: Duration, maximum: number) => DurationFunction;
        constant: (ms: number) => DurationFunction;
        decorrelatedJitter: (initial: number, maximum: number) => DurationFunction;
        exponential: (initial: number, maximum?: number) => DurationFunction;
        fibonacci: (initial: number) => DurationFunction;
        floor: (source: Duration, minimum: number) => DurationFunction;
        jitter: (source: Duration, factor: number) => DurationFunction;
        jittered: (
            initial: number,
            maximum?: number,
            factor?: number,
        ) => DurationFunction;
        linear: (initial: number, increment: number) => DurationFunction;
        map: (
            source: Duration,
            transform: (value: number, counter: number) => number,
        ) => DurationFunction;
        steps: (
            durations: { duration: number; threshold: number }[],
        ) => DurationFunction;
    } = ...

    Duration primitives and inside-out transformations for composing scheduling strategies.

    Type Declaration

    • cap: (source: Duration, maximum: number) => DurationFunction

      Limits a constant or calculated duration to a maximum value.

    • constant: (ms: number) => DurationFunction

      Returns the same duration for every counter.

    • decorrelatedJitter: (initial: number, maximum: number) => DurationFunction

      Produces stateful decorrelated jitter sampled between initial and three times the previously generated duration, then capped at maximum.

    • exponential: (initial: number, maximum?: number) => DurationFunction

      Doubles a duration for each counter after the first, with an optional maximum.

    • fibonacci: (initial: number) => DurationFunction

      Uses the Fibonacci sequence to calculate a progressively increasing duration.

    • floor: (source: Duration, minimum: number) => DurationFunction

      Raises a constant or calculated duration to a minimum value.

    • jitter: (source: Duration, factor: number) => DurationFunction

      Applies a random variation of up to factor below or above a duration.

      For example, a factor of 0.2 produces values from 80% through 120% of the source duration.

    • jittered: (initial: number, maximum?: number, factor?: number) => DurationFunction

      Applies jitter to exponential backoff, optionally capping the exponential value before jitter is applied.

    • linear: (initial: number, increment: number) => DurationFunction

      Increases a duration by a fixed amount for each counter after the first.

    • map: (
          source: Duration,
          transform: (value: number, counter: number) => number,
      ) => DurationFunction

      Transforms a resolved duration while preserving its scheduling counter.

    • steps: (durations: { duration: number; threshold: number }[]) => DurationFunction

      Returns the duration associated with the greatest threshold reached by the counter.