Registry / devops / tasks-queue

tasks-queue

JSON →
library0.0.2jsnpmunverified

A lightweight Node.js task queue that processes tasks sequentially with a configurable minimum time interval between executions. Version 0.0.2 is the current stable release. It supports push and unshift operations, event-driven task handling, and shared state via variables. Ideal for rate-limiting or throttling operations where tasks must not execute too frequently.

npm install tasks-queue
INSTALL
IMPORT
SIG · TASKS-QUEUE
T
tasks-queue
devopsjavascriptv0.0.2
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.

TasksQueue
const TasksQueue = require('tasks-queue'); const q = new TasksQueue();
import TasksQueue from 'tasks-queue';
CommonJS only; no ESM support.

Create a queue with minimum 500ms between tasks, push tasks, process them, and log final sum.

const TasksQueue = require('tasks-queue'); const q = new TasksQueue(); q.setMinTime(500); q.setVar('value', 0); q.pushTask('sample task', { n: 5 }); q.pushTask('sample task', { n: 32 }); q.pushTask('sample task', { n: 98 }); q.pushTask('sample task', { n: 33 }); q.on('sample task', (jinn, data) => { const queue = jinn.getQueue(); queue.setVar('value', data.n + queue.getVar('value')); jinn.done(); }); q.on('stop', (jinn) => { console.log('Result:', jinn.getQueue().getVar('value')); }); q.execute();
Debug
Known issues
gotchajinn.done() must be called inside task event listener to signal completion or queue will stall
fix
Call jinn.done() after processing each task
affects: >=0.0.2
breakingNo versioning consistency; package is early stage (0.0.x)
fix
Pin exact version in package.json
affects: >=0.0.2
gotchasetVar/getVar store values as object references, not copies; mutating stored objects may affect other variables
fix
Use immutable data or clone before mutation
affects: >=0.0.2
deprecatedClass returns require('events').EventEmitter; no deprecation yet
fix
N/A
affects: >=0.0.2
gotchaEvent names must match taskType exactly; case-sensitive
fix
Use identical string for event registration and pushTask
affects: >=0.0.2
Errors
Common errors & fixes
TypeError: q.pushTask is not a function
Missing require or wrong variable name
fix
const q = new (require('tasks-queue'))();
Error: done is not a function
jinn is undefined or wrong scope
fix
Ensure jinn is the first argument of the event handler
RangeError: MaxListeners exceeded
Too many event listeners per task type
fix
q.setMaxListeners(n) or remove old listeners
ReferenceError: jinn is not defined
Missing parameter in event handler
fix
queue.on('tasktype', function jinn, data { ... })
Upgrade
Version history
0.0.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
7 hits · last 30 days
node
6
Resources
tasks-queue — npm install tasks-queue · libregistry