Skip to content

ReadBudget — @gj-kit/expo-workouts

A public class from @gj-kit/expo-workouts. The signature below is taken directly from the 0.1.1 release declaration.

import { ReadBudget } from '@gj-kit/expo-workouts';
/**
* The client-side read pacer.
*
* Budgets: 900 / 15 min and 4 500 / 24 h — 10 % under the measured device constants (1000 / 5000),
* because those are server-pushed and a Mainline update can move them.
*
* It NEVER blocks: it refuses an over-budget call BEFORE the platform call with `rateLimited` and a
* computed `retryAfterMs`. Sleeping inside a 60-second poll would stall the consumer's whole
* single-flight pipeline.
*
* ⚠ Process-local and blind to another health library in the same app: Health Connect's own limiter
* is per-uid, so during a migration off another library our accounting is optimistic.
*/
declare class ReadBudget {
private readonly now;
private readonly spends;
constructor(options?: ReadBudgetOptions);
private prune;
private countSince;
/**
* `null` when `count` more reads fit right now; otherwise the milliseconds to wait before the
* oldest blocking spend leaves its window. NEVER blocks and NEVER throws.
*/
retryAfterMs(count?: number): number | null;
/**
* Charge `count` reads, or refuse with `rateLimited` + `retryAfterMs` BEFORE the platform call.
* Nothing is charged when it refuses.
*/
spend(count?: number): void;
/** 진단용 — 두 창의 현재 사용량. */
usage(): {
readonly shortWindow: number;
readonly longWindow: number;
};
}

This declaration is the source of truth for parameters, optionality, generics, return values, and public union/type contracts. Check the package golden path and this subpath’s import conditions for required environment, permission, and error boundaries before calling it.

  • Package: @gj-kit/expo-workouts
  • Version: 0.1.1
  • Public entry: .
  • Source: GitHub