npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@krizaka/pacer

v0.1.0

Published

Cadence for every Krizaka app: debounce and throttle (functions and React hooks), a job queue with concurrency, priority, retries with backoff, pause and resume per job, and a client rate limiter that learns from a server's Problem Details — TanStack Pace

Readme

@krizaka/pacer

Cadence for every Krizaka app — debounce, throttle, a job queue and a client rate limiter on TanStack Pacer (beta), behind one Krizaka package. A product imports @krizaka/pacer, never @tanstack/pacer (ADR-001): this package's version is the contract.

npm install @krizaka/pacer

ESM only. Framework-free (@krizaka/pacer) plus React hooks (@krizaka/pacer/react, React ≥ 18, web and React Native).

| Entry | What | | :-- | :-- | | @krizaka/pacer | debounce, throttle · createQueue · RateLimiter (fromProblemDetails), retryAtOf | | @krizaka/pacer/react | useDebouncedValue, useDebouncedCallback, useThrottledCallback · useQueue, useQueueSnapshot |

Debounce and throttle

import { useDebouncedCallback, useDebouncedValue } from "@krizaka/pacer/react";

const q = useDebouncedValue(text, 250);                       // the value, once typing pauses
const save = useDebouncedCallback((draft) => put(draft), 800); // save.cancel(), save.flush(), save.pending

A wait of 0 calls through at once. useThrottledCallback(fn, 100) runs the first call at once and the last one after the pause (a scroll, a pointer move, a progress).

A queue

import { createQueue } from "@krizaka/pacer";

const uploads = createQueue<{ name: string; progress: number }>({
  concurrency: 2,
  retries: 3,
  backoff: { kind: "exponential", baseMs: 1000, maxMs: 30_000, jitter: 0.2 },
  shouldRetry: (error) => !(error instanceof ClientError),   // a 4xx never deserves another try
});

const id = uploads.add(
  ({ signal, resumed, attempt }) => send(file, { signal, resumed }),   // aborted by pause / cancel
  { id: file.name, priority: 1, meta: { name: file.name, progress: 0 } },
);
uploads.update(id, (m) => ({ ...m, progress: 0.4 }));
uploads.pause(id);     // aborts its signal, keeps its place; resume(id) runs it again with `resumed: true`
uploads.retry(id);     // a failed job goes back in the line
uploads.cancel(id);    // aborts and forgets
uploads.snapshot();    // [{ id, status: "queued" | "running" | "paused" | "done" | "error", attempt, error, meta }]

In a component: const queue = useQueue<Meta>({ concurrency: 2 }); const jobs = useQueueSnapshot(queue); — the queue is aborted when the component leaves.

A rate limiter that listens to the server

import { RateLimiter } from "@krizaka/pacer";

const limiter = new RateLimiter({ limit: 5, windowMs: 1000 });
await limiter.wait(signal);                     // resolves when a call may go

// the server said 429 with a Problem Details body (or a Retry-After header):
const held = RateLimiter.fromProblemDetails(await response.json().catch(() => ({})), { now: Date.now() });
await held.wait(signal);                        // waits for retryAt / retryAfterSeconds / Retry-After

It reads the same hints as KrizakaApiError of @krizaka/query: retryAt (epoch ms or ISO date), retryAfterSeconds, or a Retry-After header (seconds or an HTTP date).

Used by

@krizaka/ui/file-upload (useUploadQueue is a queue of uploads) and @krizaka/ui/search-field (its debounce).