Registry / testing / sync-queue

sync-queue

JSON →
library0.0.2jsnpmunverified

A simple serial task queue for Node.js that processes functions in FIFO order. Version 0.0.2 (last released in 2015, likely abandoned). Unlike promise-based queues (e.g., p-limit) or worker pools, sync-queue uses a callback-driven API where each task must explicitly call queue.next() to proceed. No dependencies, no TypeScript types, no browser support. Ideal only for minimal Node.js scripts with legacy callback patterns.

npm install sync-queue
INSTALL
IMPORT
SIG · SYNC-QUEUE
S
sync-queue
testingjavascriptv0.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.

Queue
const Queue = require('sync-queue')
import Queue from 'sync-queue'
Package exports a constructor via CommonJS; no default ESM export exists.
new Queue()
const queue = new Queue()
const queue = Queue()
Queue must be called with 'new', otherwise it throws.
queue.place()
queue.place(myFunction)
queue.place(myFunction, args)
place() only accepts one function; no arguments can be passed directly — use closure.

Demonstrates serial execution: tasks run one after another, each calling next() to proceed.

const Queue = require('sync-queue'); const queue = new Queue(); queue.place(function one() { console.log('Task 1 started'); setTimeout(() => { console.log('Task 1 done'); queue.next(); }, 100); }); queue.place(function two() { console.log('Task 2 started'); queue.next(); }); queue.place(function three() { console.log('All done'); });
Debug
Known issues
breakingConstructor throws if called without 'new'
fix
Always instantiate with 'new Queue()'.
affects: >=0.0.1
gotchaTasks must call queue.next() to continue; forgetting leads to deadlock
fix
Ensure each task calls queue.next() exactly once.
affects: >=0.0.1
gotchaNo error handling — uncaught exceptions crash the queue
fix
Wrap task bodies in try/catch and call queue.next() in finally or error handler.
affects: >=0.0.1
gotchaCannot pass arguments to placed functions directly
fix
Use a closure to capture arguments: queue.place(() => myFunc(arg1, arg2)).
affects: >=0.0.1
deprecatedNo updates or maintenance since 2015
fix
Consider modern alternatives: p-queue, fastq, or async.queue.
affects: 0.0.2
Errors
Common errors & fixes
TypeError: sync_queue_1.default is not a constructor
ESM import used on a CJS-only package
fix
Use require('sync-queue') instead of import.
TypeError: Queue is not a constructor
Called Queue() without 'new'
fix
Use new Queue() to instantiate.
Error: queue.next is not a function
Lost 'this' context in setTimeout or callback
fix
Use arrow functions or bind: queue.next.bind(queue).
Upgrade
Version history
0.0.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
4
Amazon
1
Resources
sync-queue — npm install sync-queue · libregistry