pond-ts API Reference (core)
    Preparing search index...

    Type Alias LiveRollingOptions

    type LiveRollingOptions = {
        history?: boolean | RetentionPolicy;
        minSamples?: number;
        trigger?: Trigger;
    }
    Index

    Properties

    history?: boolean | RetentionPolicy

    Output retention — controls how much of the rolling's emitted history the accumulator keeps in its own buffer (the one read by length / at(i) / iteration).

    • true (default): keep every emitted event for the lifetime of the accumulator. length grows by one per trigger fire. This is the historical behaviour preserved for backward compat.
    • false: don't push to the output buffer at all. 'event' listeners still fire and value() still snapshots reducer state, but length stays at 0 and at(i) always returns undefined. Use this for high-rate live-display pipelines that consume the rolling via subscription only — the per-emit allocation cost goes away.
    • RetentionPolicy ({ maxEvents?, maxAge? }): cap the output buffer at maxEvents entries (newest kept) or maxAge ms relative to the latest emit. Field shape mirrors LiveSeriesOptions.retention; combine both for a "last N and no older than M" cap. Stricter than LiveSeries: history.maxEvents rejects 0, negative, or non-integer values at construction (LiveSeries currently accepts them silently and produces surprising eviction patterns). Pass Infinity or omit the field for no cap.

    Note: history: false is the strictest opt-out — once chosen, the accumulator never retains emits and they cannot be recovered. To consume them, attach an 'event' listener before the first push.

    minSamples?: number

    Suppress output until the window contains at least this many source events; below the threshold every reducer column emits undefined. Defaults to 0 (no gate). For count-based windows (window: number), minSamples > window means the gate never opens — output is undefined forever.

    trigger?: Trigger

    Emission cadence. Defaults to Trigger.event() — emits one snapshot per source event push (the historical behavior).

    Pass Trigger.every('30s') (or the equivalent Trigger.clock(Sequence.every('30s'))) to switch to sequence-triggered emission: one snapshot fires when a source event crosses an epoch-aligned boundary of the sequence; output timestamps are the boundary instants. If no events arrive during an interval, no event is emitted (data-driven, not wall-clock- driven).

    Pass Trigger.count(n) to emit one snapshot every n source events, useful when event-time boundaries lag during burst load but per-event emission is too noisy. Counter resets on each fire, so this measures "events since the last emission."

    For partitioned rollings (live.partitionBy(col).rolling(...)), a clock trigger emits synchronised across partitions: when any partition's event crosses the boundary, every partition's rolling-window snapshot fires at the same instant. See Trigger for the full trigger taxonomy.

    Trigger types beyond event, clock, and count are reserved for future expansion (idle, any, custom triggers). See the trigger taxonomy RFC sketch in PLAN.md.