Registry / testing / rxjs-observable-queue

rxjs-observable-queue

JSON →
library1.0.18jsnpmunverified

A lightweight RxJS utility that enqueues observables and executes them sequentially. Current stable version is 1.0.18. The library is minimal and stable with infrequent updates. It queues observables and guarantees order of execution, with automatic queue clearing on error. Unlike custom solutions, it provides a simple, tested abstraction over RxJS schedulers.

npm install rxjs-observable-queue
INSTALL
IMPORT
SIG · RXJS-OBSERVABLE-QU
R
rxjs-observable-queue
testingjavascriptv1.0.18
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.

ObservableQueue
import { ObservableQueue } from 'rxjs-observable-queue'
const ObservableQueue = require('rxjs-observable-queue')
Package is ESM-only and provides TypeScript types.
ObservableQueue class
new ObservableQueue()
Constructor takes no arguments.
addItem method
queue.addItem(obs).subscribe(callback)
queue.addItem(obs, callback)
addItem returns an Observable, not a subscription. Use .subscribe() on it.

Creates a queue, adds two delayed observables, and logs their results in order.

import { ObservableQueue } from 'rxjs-observable-queue'; import { of, delay } from 'rxjs'; const queue = new ObservableQueue(); const mockRequest1 = of(1).pipe(delay(500)); const mockRequest2 = of(2).pipe(delay(500)); queue.addItem(mockRequest1).subscribe(console.log); // prints '1', after 500ms queue.addItem(mockRequest2).subscribe(console.log); // prints '2', after 1000ms
Debug
Known issues
gotchaOn error, the queue is cleared and all pending observables are discarded.
fix
Handle errors in each subscription to avoid losing queued items.
affects: >=1.0.0
gotchaaddItem returns an observable; you must subscribe to it to trigger execution.
fix
Always call .subscribe() on the result of addItem.
affects: >=1.0.0
deprecatedThe package uses RxJS version 6+; migration to RxJS 7 may require updating peer dependency.
fix
Ensure rxjs@^6 is installed; for RxJS 7 check compatibility.
affects: >=1.0.0
gotchaThe queue does not support cancellation of a running observable; it must complete naturally.
fix
Use takeUntil or other operators inside the observable if cancellation is needed.
affects: >=1.0.0
Errors
Common errors & fixes
ObservableQueue is not a constructor
Incorrect import or missing default export
fix
Use import { ObservableQueue } from 'rxjs-observable-queue'.
addItem is not a function
Calling addItem on an uninitialized queue or wrong instance
fix
Ensure queue is created with new ObservableQueue().
Cannot read property 'subscribe' of undefined
addItem returns undefined if not called on a valid queue instance
fix
Check that queue.addItem returns an observable and subscribe to it.
Upgrade
Version history
1.0.18latest on npm
Audit
Dependencies
rxjsrequiredPeer dependency for Observable and operators
Agent activity
5 hits · last 30 days
node
4
Amazon
1
Resources
rxjs-observable-queue — npm install rxjs-observable-queue · libregistry