Registry / devops / d3-queue

d3-queue

JSON →
library3.0.7jsnpmunverified

d3-queue is a lightweight library for evaluating asynchronous tasks with configurable concurrency. Current stable version is 3.0.7, released in 2018. It is a standalone module of the D3 ecosystem, offering a minimal footprint (about 700 bytes gzipped vs 4,300 for Async.js). Key differentiators include small size, simple API via defer/await/awaitAll, abortable tasks, and first-class support for Node.js callback patterns. It is suitable for controlling parallel task execution in both browser and Node.js environments.

npm install d3-queue
INSTALL
IMPORT
SIG · D3-QUEUE
D
d3-queue
devopsjavascriptv3.0.7
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 'd3-queue';
import d3 from 'd3-queue';
ESM named import; default import is not available.
queue
const { queue } = require('d3-queue');
const d3 = require('d3-queue');
CJS destructured require; the module exports only the queue function, not a default object.
queue
const q = d3.queue();
const q = new d3.queue();
If using legacy global `d3` from D3 bundle, queue is accessed via `d3.queue()` as a function, not a constructor.

Creates a queue with concurrency limit 2, defers three tasks, and calls awaitAll to process results.

const { queue } = require('d3-queue'); function delayedHello(name, delay, callback) { setTimeout(() => { console.log(`Hello, ${name}!`); callback(null); }, delay); } const q = queue(2); // concurrency limit of 2 q.defer(delayedHello, 'Alice', 250); q.defer(delayedHello, 'Bob', 500); q.defer(delayedHello, 'Carol', 750); q.awaitAll((error, results) => { if (error) throw error; console.log('All done!'); });
Debug
Known issues
breakingd3-queue v3 dropped support for Node.js versions < 6.
fix
Upgrade Node.js to version 6 or later, or use d3-queue v2.
affects: >=3.0.0
breakingIn v2, the queue function required d3-collection; v3 is standalone.
fix
Install d3-collection as a peer dependency when using v2, or upgrade to v3.
affects: >=2.0.0 <3.0.0
deprecatedThe package has not seen updates since 2018; it is in maintenance mode with no active development.
fix
Consider migrating to async/await patterns or libraries like p-limit for modern use.
affects: >=3.0.0
gotchaIf a task calls callback with multiple arguments, only the first result is passed to awaitAll; wrap in array/object for multiple values.
fix
Use callback(null, [value1, value2]) or callback(null, { a: 1, b: 2 }).
affects: >=1.0.0
gotchaAbort does not cancel already completed tasks; it only stops pending and in-progress abortable tasks.
fix
Ensure tasks implement abort logic to cleanly terminate.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'd3-queue'
Missing npm install or incorrect import path.
fix
Run 'npm install d3-queue' or add to package.json.
TypeError: d3.queue is not a function
Importing as default when the module exports only named export.
fix
Use 'import { queue } from 'd3-queue'' or 'const { queue } = require('d3-queue')'.
TypeError: q.await is not a function
Using awaitAll method when expecting await (they are different).
fix
Use q.await(callback) for single result or q.awaitAll(callback) for array of results.
AssertionError [ERR_ASSERTION]: The callback must be a function
Passing undefined or non-function to defer or await.
fix
Ensure that defer takes a task function (with callback as last argument) and await/awaitAll takes a callback function.
Upgrade
Version history
3.0.7latest on npm
Audit
Dependencies
d3-collectionoptionalMay be needed for older versions (v2) but not required in v3
Agent activity
10 hits · last 30 days
node
6
Bingbot
1
Resources
d3-queue — npm install d3-queue · libregistry