开发者近日发布了Temporize库,这是一个为TypeScript设计的Promise感知型时序和并发控制工具集[1]。该库提供了debounce、throttle、batch、retry、idle和concurrencyLimit等核心功能[1],支持React和Vue的可选适配器[1]。
Temporize库具有轻量化的设计特点,各功能模块体积均控制在1KB以下,其中debounce压缩后721字节,throttle 759字节,rafThrottle 236字节[1]。React适配器入口大小为1,169字节,Vue适配器为1,089字节[1]。该库支持AbortSignal和多种重试策略(包括queue、drop、cancel-previous),采用MIT许可证发布,零框架和运行时依赖[1]。
A new TypeScript library called Temporize has been introduced to provide developers with Promise-aware utilities for managing asynchronous operations and concurrency control [1]. The library offers a comprehensive set of timing and concurrency tools including debounce, throttle, batch, retry, idle, and concurrencyLimit functions [1].
Temporize is designed with minimal bundle size as a core priority [1]. The debounce function compiles to 721 bytes minified, throttle to 759 bytes, and rafThrottle to just 236 bytes, with all core utilities kept under 1 kilobyte [1]. Optional adapters for React and Vue are available, adding 1,169 bytes and 1,089 bytes respectively to the bundle [1]. The library carries no runtime dependencies and is released under the MIT license [1].
The library supports advanced features including AbortSignal integration and multiple retry strategies—queue, drop, and cancel-previous modes [1]. This allows developers to handle edge cases when managing debounced and throttled Promise-based operations with flexible control over how retries are processed [1].