Registry / devops / ev-queue

ev-queue

JSON →
library1.0.3jsnpmunverified

A lightweight, promise-based queuing library for scheduling async functions with configurable delays and priority levels. The package enables sequential execution of asynchronous tasks, supporting high-priority and low-priority queues to manage rate limits and background jobs effectively. Current stable version 1.0.3 features a simple API, TypeScript definitions, default queue sizes, and no external dependencies. It is ideal for scenarios like API rate limiting, database updates, or any sequential async processing where delay and priority control are needed.

npm install ev-queue
INSTALL
IMPORT
SIG · EV-QUEUE
E
ev-queue
devopsjavascriptv1.0.3
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.

EvQueue
import EvQueue from 'ev-queue'
const EvQueue = require('ev-queue')
ESM default import; CommonJS require works if using bundler or Node < 16, but ESM is preferred for modern Node.
EvQueueOptions
import { EvQueueOptions } from 'ev-queue'
import EvQueueOptions from 'ev-queue'
EvQueueOptions is a named TypeScript type export, not a default export. Use curly braces for type imports.
EvQueueInstance
import type { EvQueueInstance } from 'ev-queue'
import { EvQueueInstance } from 'ev-queue'
EvQueueInstance is a TypeScript interface for the class instance; use import type to avoid runtime overhead.

Creates an EvQueue instance with 1s delay, adds a low-priority async task and a high-priority task, and logs their results.

import EvQueue from 'ev-queue'; const queue = new EvQueue({ delay: 1000, maxSize: 50, maxHighPriority: 5 }); const asyncTask = () => new Promise(resolve => setTimeout(() => resolve('done'), 500)); async function run() { const result1 = await queue.add(asyncTask, 'low'); console.log(result1); // 'done' const result2 = await queue.add(() => Promise.resolve('high'), 'high'); console.log(result2); // 'high' } run().catch(console.error);
Debug
Known issues
gotchaUsing require() may cause ESM import issues if the package is consumed in a pure ESM environment.
fix
Use import syntax instead of require().
affects: >=1.0.0
gotchaThe delay option is the minimum delay between tasks; actual execution time may be longer due to task duration and queue size.
fix
Account for task execution time when setting delay to meet rate limits.
affects: >=1.0.0
deprecatedThe priority option in add() may change in future versions; upcoming features plan to replace it with a more flexible rate-limit option.
fix
Stay updated with new releases and migrate when the rate-limit option is introduced.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: EvQueue is not a constructor
Using default import with CommonJS require incorrectly.
fix
Use 'const EvQueue = require("ev-queue").default' or switch to ESM import.
Cannot find module 'ev-queue'
Package not installed or import path wrong.
fix
Run 'npm install ev-queue' and ensure the import is correct.
TypeError: queue.add is not a function
EvQueue instance not created correctly (e.g., missing 'new').
fix
Instantiate with 'new EvQueue(options)'.
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
4 hits · last 30 days
node
4
Resources
ev-queue — npm install ev-queue · libregistry