@pond-ts/react API Reference
    Preparing search index...

    Function useEventRate

    • Subscribe to a live source, maintain a .window(duration) view over it, and return its events-per-second as a reactive number.

      Type Parameters

      • S extends SeriesSchema

      Parameters

      Returns number

      const eventRate = useEventRate(liveSeries, '1m');
      // <div>EVENT RATE {eventRate.toFixed(1)}/s</div>

      Sugar over live.window(duration).eventRate() plus a subscription that re-reads on each push and throttles updates. Closes the boilerplate that the gRPC experiment's M1 friction notes surfaced — useCurrent(live, { cpu: 'count' }, { tail: '1m' }).cpu / 60 collapses to one hook.

      Throttling matches useSnapshot: throttle: 100 ms by default. Returns 0 until the first event lands.

      TypeError if windowDuration is a count-based window (a number) — eventRate requires a time denominator. Pass a duration string like '1m', '30s', or a number-of-ms via DurationInput instead.