Pool.js

A lightweight resource pool scheduler with Scheduler, CoolDown, and explicit resource management.

Built on ES2024 explicit resource management with Symbol.dispose / Symbol.asyncDispose.

npm versionlicensenpm downloadscoverageBuild Status
Install
npm install @cat5th/pool.js

Features

Explicit Resource Management

Based on ES2024 Symbol.dispose, resources are automatically released when leaving scope, preventing resource leaks.

Task Scheduler

Scheduler automatically dispatches tasks to idle resources, supporting both wrap and enqueue calling styles.

CoolDown Mechanism

CoolDown callback controls the interval before a resource becomes available again after release, enabling rate limiting.

Flexible Configuration

Support factory functions, pre-created resources, custom concurrency, and async disposal.

Zero Dependencies

Pure TypeScript implementation with no external dependencies, lightweight and ready to use.

Async Cleanup

Symbol.asyncDispose waits for all resources to return before cleanup, ensuring complete lifecycle management.

Quick Start

Basic Usage

Scheduler

Try the Live Demo

Learn how Pool.js works through the interactive Playground

Open Playground →