Registry / testing / sequential-queue

sequential-queue

JSON →
library1.0.5jsnpmunverified

A lightweight async task queue that enforces sequential execution, ensuring tasks complete one after another. v1.0.5 is the latest stable release; updates are infrequent since the API is minimal and stable. Compared to more complex libraries like bull or bee-queue, this is a zero-dependency solution ideal for scenarios where you simply need to serialize async operations without persistence or scheduling features. It provides a simple Queue class with enqueue, start, stop, and clear methods.

npm install sequential-queue
INSTALL
IMPORT
SIG · SEQUENTIAL-QUEUE
S
sequential-queue
testingjavascriptv1.0.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.

Queue
import { Queue } from 'sequential-queue'
const Queue = require('sequential-queue').Queue
ESM only; named export.
Task
import type { Task } from 'sequential-queue'
import { Task } from 'sequential-queue'
Task is a type helper, not a runtime export.
default import
import SeqQueue from 'sequential-queue'
import { default as SeqQueue } from 'sequential-queue'
Default export is the Queue class itself.

Creates a queue, adds two async tasks, and starts sequential execution.

import { Queue } from 'sequential-queue'; const q = new Queue(); q.enqueue(async () => { console.log('Task 1'); await sleep(100); }); q.enqueue(async () => { console.log('Task 2'); }); q.start(); function sleep(ms: number) { return new Promise(resolve => setTimeout(resolve, ms)); }
Debug
Known issues
gotchaQueue does not automatically start; you must call .start() after enqueuing tasks.
fix
Call queue.start() after adding all tasks.
affects: >=1.0.0
gotchaCalling .stop() will not cancel the currently running task; it only prevents the next task from starting.
fix
Ensure running tasks handle cancellation themselves if needed.
affects: >=1.0.0
gotchaQueue does not handle errors; rejections from tasks are silently ignored.
fix
Wrap task content in try-catch or use .enqueue with a promise that never rejects.
affects: >=1.0.0
deprecatedThe default export is deprecated in favor of named export 'Queue'.
fix
Use `import { Queue } from 'sequential-queue'` instead of default import.
affects: >=1.0.5
Errors
Common errors & fixes
TypeError: queue.start is not a function
Using default import as a constructor but forgetting to call new.
fix
Ensure you instantiate: const q = new Queue();
ReferenceError: Queue is not defined
Using CommonJS require without destructuring.
fix
Use const { Queue } = require('sequential-queue');
Upgrade
Version history
1.0.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

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