Registry / productivity / reactor

reactor

JSON →
library13.0.4jsnpmunverified

A work queue that pivots events to error-first callbacks. Version 13.0.4 provides an asynchronous task queue library for Node.js, allowing developers to define and run tasks with error-first callbacks. It offers a flexible and efficient way to manage work queues, similar to Cadence. The library is maintained and follows a regular release cadence. Unlike other task queues, reactor focuses on converting event-driven flows into callback-based patterns, making it suitable for scenarios like batch processing or workflow orchestration with explicit error handling.

npm install reactor
INSTALL
IMPORT
SIG · REACTOR
R
reactor
productivityjavascriptv13.0.4
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.

Reactor
import { Reactor } from 'reactor'
const Reactor = require('reactor')
ESM-only; if using CommonJS, use dynamic import or ensure Node.js version supports it.
createReactor
import { createReactor } from 'reactor'
const { createReactor } = require('reactor')
ESM-only; default export is not available, use named import.
ReactorTask
import { ReactorTask } from 'reactor'
import ReactorTask from 'reactor'
ReactorTask is a named export, not a default export.

Demonstrates creating a reactor work queue with a simple task that logs a message and handles completion or error via a callback.

import { createReactor } from 'reactor'; import { cadence } from 'cadence'; const work = createReactor(function (step) { step(function (step) { step(console.log, 'Hello, world!'); step(); }); }); work(function (error) { if (error) console.error(error); else console.log('Complete'); });
Debug
Known issues
breakingVersion 13.x dropped CommonJS support; all imports must use ESM syntax.
fix
Convert require() calls to import statements; use dynamic import if necessary.
affects: >=13.0.0
deprecatedThe default export 'Reactor' is deprecated as of v13; use named 'createReactor' instead.
fix
Replace 'new Reactor()' with 'createReactor()'.
affects: >=13.0.0
gotchaMissing 'cadence' peer dependency causes runtime errors; it must be installed separately.
fix
Install cadence: npm install cadence
affects: >=13.0.0
gotchaReactor tasks must always call step() to advance the queue; forgetting to invoke step() causes hangs.
fix
Ensure step() is called exactly once per callback to continue the workflow.
affects: >=1.0.0
Errors
Common errors & fixes
Error: Cannot find module 'cadence'
Cadence peer dependency not installed.
fix
npm install cadence
TypeError: Reactor is not a constructor
Using deprecated default export 'Reactor' in v13.0.4.
fix
Use 'createReactor' named import.
SyntaxError: Cannot use import statement outside a module
Running ESM import in a CommonJS project without proper configuration.
fix
Add "type": "module" to package.json or rename file to .mjs.
Upgrade
Version history
13.0.4latest on npm
Audit
Dependencies
cadencerequiredCore dependency for asynchronous control flow management
Agent activity
26 hits · last 30 days
node
24
OpenAI (training)
1
Resources
reactor — npm install reactor · libregistry