@hecto/pacer
v1.0.1
Published
Observable timing and work-admission controllers for TypeScript
Readme
@hecto/pacer
Observable debounce, throttle, rate-limit, queue and batch controllers for TypeScript.
import { createAsyncDebouncer, isPacingCancellation } from '@hecto/pacer'
const search = createAsyncDebouncer(
async ({ signal }, query: string) => fetch(`/search?q=${query}`, { signal }).then((r) => r.json()),
{ waitMs: 250 },
)
search.submit('boiler').result.catch((error) => {
if (!isPacingCancellation(error)) reportError(error)
})Controllers are inert until work is submitted. Owners must observe every async ticket and call dispose() during teardown. Framework adapters are available from /react, /vue, /svelte, /solid and /angular.
The existing @hecto/async debounce, throttle and rateLimit helpers remain available pending explicit breaking-migration authorization.
