Registry / devops / breeze-queue

breeze-queue

JSON →
library0.4.0jsnpmunverified

Throttled parallel function invocation queue for Node.js and the browser. Version 0.4.0 (latest) is stable but unmaintained; last release in 2012. Provides a simple API to process items with a concurrency limit, supporting drain, empty, and error events.

npm install breeze-queue
INSTALL
IMPORT
SIG · BREEZE-QUEUE
B
breeze-queue
devopsjavascriptv0.4.0
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
var Queue = require('breeze-queue');
import Queue from 'breeze-queue';
CJS-only; no ES module support.
queue
var queue = Queue(fn, concurrency); queue.push(item, callback, autostart);
var queue = new Queue(fn, concurrency);
Factory function, not a constructor; do not use 'new'.
.onerror
queue.onerror = function(err) { ... };
queue.on('error', function(err) { ... });
Not an EventEmitter; assign function directly to the property.

Creates a queue with concurrency 2, pushes 3 items with autostart, and sets a drain listener.

var Queue = require('breeze-queue'); var queue = Queue(function(item, next) { console.log('Process:', item); setTimeout(next, 1000); }, 2); queue.push(['a', 'b', 'c'], function(err) { if (err) console.error(err); else console.log('done'); }, true); queue.drain = function() { console.log('All done!'); };
Debug
Known issues
gotchaThe queue does not start processing unless autostart is true in push() or .process() is called manually.
fix
Set autostart to true in push() or call queue.process() after pushing items.
affects: >=0.0.0
gotchaIf the queue drains and then a new item is pushed without autostart, it will not start again.
fix
Include autostart: true in the new push call or call .process() again.
affects: >=0.0.0
deprecatedPackage is unmaintained since 2012; no updates for Node.js versions beyond 0.10.
fix
Consider migrating to async.queue or other actively maintained queue libraries.
affects: >=0.4.0
Errors
Common errors & fixes
TypeError: Queue is not a constructor
Using 'new Queue(...)' instead of calling Queue as a factory function.
fix
Use: var queue = Queue(iterator, concurrency);
ReferenceError: require is not defined
Using require() in a browser environment without CommonJS bundler.
fix
Use a bundler like Browserify or Webpack, or use the component version.
TypeError: queue.on is not a function
Treating queue as an EventEmitter and trying to call .on() for events.
fix
Assign event handler functions directly to properties: queue.drain = function() {};
Upgrade
Version history
0.4.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
breeze-queue — npm install breeze-queue · libregistry