A persistent queue system for browser environments that stores tasks in localStorage, IndexedDB, in-memory, or custom storage drivers. Version 1.2.6 is the latest stable release. Tasks are processed asynchronously via worker classes (or native Web Workers). Supports multiple independent channels, configurable retries, priority sorting, and React Native with minor configuration. Designed for offline-capable web apps that need reliable job processing with error handling. Release cadence is low; library is stable but rarely updated as of 2024. Differentiates from backend queues by being entirely client-side.
npm install storage-based-queueNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a queue with localStorage storage, adds a task, defines a worker, starts processing, and listens for events.
Be aware that channel options are global. Do not rely on per-instance configuration for different channels.
Ensure worker returns Promise<boolean> (true) on success, Promise.reject (any) to skip, or resolves to false to trigger retry.
Monitor storage usage or use an alternative storage adapter (e.g., IndexedDB via custom driver) for larger queues.
Set sort: 'priority' in options if you want tasks to be ordered by priority field.
Instead of relying on the polyfill, consider using a dedicated polyfill or bundling a Worker polyfill manually.
const queue = new Queue({ channel: 'myChannel' });queue.run(worker); where worker is a function returning a Promise.
Check task exists: if (task?.data) { ... }Use 'memory' storage driver or catch errors and switch to memory: new Queue({ channel: 'ch', storage: 'memory' });No dependency data recorded yet.