{"id":45989,"library":"queue-that","title":"queue-that","description":"A browser-based queue managed in localStorage for batching and deferring async tasks (e.g., XHR requests) until just before page unload. Current stable version 2.9.0, released as needed on GitHub. It batches tasks into 100ms groups, supports cross-tab coordination (only one active queue per label), exponential backoff on failure, configurable batch size and timeout, and falls back to an in-memory variable if localStorage throws. Distinct from generic queue libraries by its localStorage persistence and unload-safe flushing.","status":"active","version":"2.9.0","language":"javascript","source_language":"en","source_url":"ssh://git@github.com/QubitProducts/queue-that","tags":["javascript","queue"],"install":[{"cmd":"npm install queue-that","lang":"bash","label":"npm"},{"cmd":"yarn add queue-that","lang":"bash","label":"yarn"},{"cmd":"pnpm add queue-that","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package is CJS-only; import works only with bundlers that interop with CJS, or use require() in Node/Browserify.","wrong":"const queueThat = require('queue-that')","symbol":"queueThat","correct":"import queueThat from 'queue-that'"},{"note":"The default export is a factory function that expects an options object. Do not destructure named exports; there are none.","wrong":"","symbol":"queueThat","correct":"const queueThat = require('queue-that')"},{"note":"The function must be called with options; if called directly (without assigning), the returned function is lost.","wrong":"const q = require('queue-that')({ label: 'x' })","symbol":"queueThat","correct":"const queueThat = require('queue-that'); const q = queueThat({ process: (batch, done) => done() })"}],"quickstart":{"code":"const queueThat = require('queue-that');\n\nconst q = queueThat({\n  label: 'MyQueue',\n  process: (batch, done) => {\n    // Send batch to server\n    console.log('Processing batch:', batch);\n    done();\n  },\n  batchSize: 10\n});\n\n// Queue a task\nconst task = { type: 'click', data: { x: 100, y: 200 } };\nq(task);","lang":"javascript","description":"Creates a queue with a process function and queues a single task."},"warnings":[{"fix":"Wrap queueThat initialization in try/catch or use a polyfill for localStorage if you need guaranteed persistence.","message":"localStorage may throw in private browsing mode or be unavailable; queue-that falls back to an in-memory variable, which is not persistent between page loads.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Always call done() in your process implementation, including on error (with an error argument to trigger backoff).","message":"The process function must call the done callback; if not called, the queue will hang and never process further batches after the 2-second timeout and backoff.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Adjust batchSize or queueGroupTime to control batching behaviour.","message":"Tasks are batched into 100ms groups by default; if you queue a task and immediately queue another within 100ms, they may end up in the same batch. To disable batching set batchSize to Infinity.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade to v2 and call require('queue-that')() with options object.","message":"In version 2.0.0, the API changed from requiring 'queue-that' directly to a factory function pattern. Old code using the module as a constructor will break.","severity":"breaking","affected_versions":"~1.0.0"}],"env_vars":null,"search_vec":"'100ms':39 '2.9.0':29 'activ':48 'async':16 'back':63 'backoff':53 'base':7 'batch':13,36,57 'browser':6 'browser-bas':5 'configur':56 'coordin':45 'cross':43 'cross-tab':42 'current':26 'defer':15 'distinct':73 'e.g':18 'exponenti':52 'failur':55 'fall':62 'flush':86 'generic':75 'github':34 'group':40 'in-memori':66 'javascript':87 'label':51 'librari':77 'localstorag':11,71,80 'manag':9 'memori':68 'need':32 'one':47 'page':24 'per':50 'persist':81 'queue':2,8,49,76,88 'queue-that':1 'releas':30 'request':20 'safe':85 'size':58 'stabl':27 'support':41 'tab':44 'task':17,37 'throw':72 'timeout':60 'unload':25,84 'unload-saf':83 'variabl':69 'version':28 'xhr':19","created_at":"2026-06-07T12:57:43.980913+00:00","updated_at":"2026-06-07T12:57:43.980913+00:00","problems":[{"fix":"Use const queueThat = require('queue-that'); instead of import queueThat from 'queue-that'.","cause":"Using import syntax with a CJS-only package without a bundler that handles CJS interop.","error":"TypeError: queueThat is not a function"},{"fix":"Use distinct label strings for logically separate queues.","cause":"Two queues with the same label interfere because they share localStorage key.","error":"Error: label 'Queue That' already in use"},{"fix":"Ensure process() calls done() asynchronously (e.g., setTimeout 0) to avoid stack overflow.","cause":"The queue triggers recursive processing when process() calls done() synchronously and the queue is full.","error":"RangeError: Maximum call stack size exceeded"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/QubitProducts/queue-that#readme","github":"ssh://git@github.com/QubitProducts/queue-that","docs":null,"changelog":null,"pypi":null,"npm":"queue-that","openapi_spec":null,"status_page":null,"smithery":null,"categories":["storage"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}