Throttled fan-in point for progress ticks during a load.

Hot loops call update() as often as they like (it is cheap); events are only materialized and forwarded at most once per minIntervalMs, plus unthrottled events at phase begin/end so consumers always see phase boundaries. Memory is sampled only when an event is actually emitted.

Constructors

  • Construct this with the callback progress events are forwarded to.

    Parameters

    • onProgress: ProgressCallback

      The consumer callback.

    • minIntervalMs: number = DEFAULT_PROGRESS_INTERVAL_MS

      Minimum milliseconds between throttled events.

    Returns ProgressTracker

Accessors

  • get phase(): undefined | ProgressPhase
  • The currently reporting phase, if any.

    Returns undefined | ProgressPhase

    The current phase.

Methods

  • Begin a phase, emitting an unthrottled zero-progress event.

    Parameters

    • phase: ProgressPhase

      The phase being entered.

    • unit: ProgressUnit

      The unit completed/total are measured in for this phase.

    • Optionaltotal: number

      The total units for this phase, when known up front.

    Returns void

  • End the current phase, emitting an unthrottled final event with completed === total when a total is known.

    Parameters

    • Optionalcompleted: number

      Final completed units (defaults to the phase total).

    Returns void

  • Set/replace the current phase's total once it becomes known (e.g. product count discovered inside geometry extraction).

    Parameters

    • total: number

      The total units for the current phase.

    Returns void

  • Report progress within the current phase; throttled.

    Parameters

    • completed: number

      Units completed so far.

    Returns void