TanStack Pacer v0
Utilities for debouncing, throttling, rate limiting, queuing, and more.
Try other TanStack libraries:
- TanStack Router
- TanStack Query
- TanSack Table
- TanStack Virtual
- TanStack Form
- TanStack Store
- TanStack Ranger
- TanStack Pacer
- TanStack Config
Visit tanstack.com/pacer for docs, guides, API and more!
You may know TanSack Pacer by our adapter names, too!
- React Pacer
- Solid Pacer
- Angular Pacer - needs a contributor!
- Preact Pacer - Coming soon! (After React Pacer is more fleshed out)
- Svelte Pacer - needs a contributor!
- Vue Pacer - needs a contributor!
Take control of your application's timing with TanStack Pacer's rate limiting, throttling, and debouncing utilities. Manage complex async workflows using intelligent queuing and concurrency controls while maintaining full control with built-in pause, resume, and cancel capabilities.
- Debouncing
- Delay execution until after a period of inactivity for when you only care about the last execution in a sequence.
- Synchronous or Asynchronous Debounce utilities with promise support and error handling
- Control of leading, trailing, and enabled options
- Throttling
- Smoothly limit the rate at which a function can fire
- Synchronous or Asynchronous Throttle utilities with promise support and error handling
- Control of leading, trailing, and enabled options.
- Rate Limiting
- Limit the rate at which a function can fire over a period of time
- Synchronous or Asynchronous Rate Limiting utilities with promise support and error handling
- Fixed or Sliding Window variations of Rate Limiting
- Queuing
- Queue functions to be executed in a specific order
- Choose from FIFO, LIFO, and Priority queue implementations
- Control processing speed with configurable wait times or concurrency limits
- Manage queue execution with start/stop capabilities
- Expire items from the queue after a configurable duration
- Batching
- Chunk up multiple operations into larger batches to reduce total back-and-forth operations
- Batch by time period, batch size, whichever comes first, or a custom condition to trigger batch executions
- Async or Sync Variations
- Choose between synchronous and asynchronous versions of each utility
- Optional error, success, and settled handling for async variations
- Comparison Utilities
- Perform deep equality checks between values
- Create custom comparison logic for specific needs
- Convenient Hooks
- Reduce boilerplate code with pre-built hooks like
useDebouncedCallback
,useThrottledValue
, anduseQueuedState
, and more. - Multiple layers of abstraction to choose from depending on your use case.
- Works with each framework's default state management solutions, or with whatever custom state management library that you prefer.
- Reduce boilerplate code with pre-built hooks like
- Type Safety
- Full type safety with TypeScript that makes sure that your functions will always be called with the correct arguments
- Generics for flexible and reusable utilities
- Framework Adapters
- React, Solid, and more
- Tree Shaking
- We, of course, get tree-shaking right for your applications by default, but we also provide extra deep imports for each utility, making it easier to embed these utilities into your libraries without increasing the bundle-phobia reports of your library.
Install one of the following packages based on your framework of choice:
# Npm
npm install @tanstack/react-pacer
npm install @tanstack/solid-pacer
npm install @tanstack/pacer # no framework, just vanilla js