Registry / productivity / exframe-task-pool

exframe-task-pool

JSON →
library1.3.5jsnpmunverified

exframe-task-pool v1.3.5 is a lightweight Node.js library for queuing and executing tasks in a systematic, sequential or parallel manner. It supports task prioritization, concurrency limits, and lifecycle hooks (onStart, onComplete, onError). Suitable for Node >=14.0.0, with TypeScript definitions included. Updated infrequently via npm.

npm install exframe-task-pool
INSTALL
IMPORT
SIG · EXFRAME-TASK-POOL
E
exframe-task-pool
productivityjavascriptv1.3.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TaskPool
import { TaskPool } from 'exframe-task-pool'
const TaskPool = require('exframe-task-pool').TaskPool
Named export; requires ESM or CJS destructure. Use import { TaskPool } for ESM.
default
import TaskPool from 'exframe-task-pool'
const TaskPool = require('exframe-task-pool')
Default export is available but not documented; prefer named export for clarity.
TaskPriority
import { TaskPriority } from 'exframe-task-pool'
TypeScript users can import the enum for task priority levels (HIGH, NORMAL, LOW).

Creates a TaskPool with concurrency 2, adds two tasks with different priorities, and starts execution.

import { TaskPool } from 'exframe-task-pool'; const pool = new TaskPool({ concurrency: 2 }); const task1 = () => new Promise(resolve => setTimeout(() => { console.log('Task 1 done'); resolve('result1') }, 1000)); const task2 = () => new Promise(resolve => setTimeout(() => { console.log('Task 2 done'); resolve('result2') }, 500)); pool.addTask(task1, { priority: 'HIGH' }); pool.addTask(task2, { priority: 'NORMAL' }); pool.onComplete(() => console.log('All tasks finished')); pool.start();
Debug
Known issues
gotchaTask function must return a Promise; otherwise behavior is undefined.
fix
Wrap synchronous tasks in Promise.resolve() or use async functions.
affects: >=1.0.0
deprecatedMethod `add` is deprecated since v1.3.0; use `addTask` instead.
fix
Replace pool.add(task) with pool.addTask(task, options).
affects: >=1.3.0
gotchaConcurrency limit is applied per TaskPool instance; if tasks are added after start, they are queued.
fix
Ensure all tasks are added before calling start() to avoid unexpected order.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: TaskPool is not a constructor
CommonJS require() used incorrectly; package is ESM-first.
fix
Use import { TaskPool } from 'exframe-task-pool' or const { TaskPool } = require('exframe-task-pool').
Error: Task must be a function that returns a Promise.
A non-async function or value was passed as a task.
fix
Ensure each task is an async function or returns a Promise.
Upgrade
Version history
1.3.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
26 hits · last 30 days
node
24
OpenAI (training)
1
Resources
exframe-task-pool — npm install exframe-task-pool · libregistry