{"id":46523,"library":"std-client-run-queue","title":"std-client-run-queue","description":"A TypeScript run queue that schedules and manages async tasks to minimize client-side interactivity disruptions. Current version 0.0.1, early development with frequent releases. Supports configurable max parallelism, work units, continuous work duration, priority levels, per-entry cancellation, and optional delay and never-cancel flags. Provides coordination hooks for React Native via InteractionManager. Differentiators include client-focus, customizable runAfterInteractions, stats tracking, and priority scheduling with fine-grained control over task execution order and cancellation.","status":"active","version":"0.0.1","language":"javascript","source_language":"en","source_url":null,"tags":["javascript","promise","concurrency","limit","throttle","queue","priority","typescript","client"],"install":[{"cmd":"npm install std-client-run-queue","lang":"bash","label":"npm"},{"cmd":"yarn add std-client-run-queue","lang":"bash","label":"yarn"},{"cmd":"pnpm add std-client-run-queue","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only; this package does not support CommonJS require()","wrong":"const { RunQueue } = require('std-client-run-queue')","symbol":"RunQueue","correct":"import { RunQueue } from 'std-client-run-queue'"},{"note":"CANCELED is a named export, not default","wrong":"import CANCELED from 'std-client-run-queue'","symbol":"CANCELED","correct":"import { CANCELED } from 'std-client-run-queue'"},{"note":"Named constant for default priority value","symbol":"DEFAULT_PRIORITY","correct":"import { DEFAULT_PRIORITY } from 'std-client-run-queue'"}],"quickstart":{"code":"import { CANCELED, DEFAULT_PRIORITY, RunQueue } from 'std-client-run-queue';\n\nconst main = async () => {\n  const q = new RunQueue('my-queue');\n  const doSomeWork = async () => {\n    await new Promise((resolve) => setTimeout(resolve, Math.random() * 1000));\n    return Math.random();\n  };\n  const entry = q.schedule(DEFAULT_PRIORITY, 'my-function', doSomeWork);\n  console.log('canceled', entry.wasCanceled());\n  console.log('completed', entry.wasCompleted());\n  console.log('started', entry.wasStarted());\n  const result = await entry.promise;\n  if (result.ok) {\n    console.log('success', result.details);\n  } else if (result.details === CANCELED) {\n    console.log('canceled');\n  } else {\n    console.log('failure', result.details);\n  }\n  q.schedule(2, 'my-function', doSomeWork, { delayMSec: 1000 });\n  q.schedule(0, 'my-function', doSomeWork, { neverCancel: true });\n  q.schedule(1, 'my-function', doSomeWork);\n  console.log('queue length', q.getQueueLength());\n  q.cancelAll();\n};\nmain().catch(console.error);","lang":"typescript","description":"Creates a RunQueue, schedules functions with different priorities and options, checks entry status, waits for results, and cancels all."},"warnings":[{"fix":"Pass a string identifier to new RunQueue('my-queue').","message":"RunQueue constructor requires a non-empty string queueId.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Check entry.promise result for ok/canceled/failure status.","message":"The wasStarted() and wasCompleted() methods are deprecated; use the promise result instead.","severity":"deprecated","affected_versions":"0.0.1"},{"fix":"Invoke setRunAfterInteractions early in app initialization.","message":"The setRunAfterInteractions function must be called before scheduling any entries to take effect.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'0.0.1':25 'async':14 'cancel':45,52,84 'client':3,19,65,93 'client-focus':64 'client-sid':18 'concurr':87 'configur':32 'continu':37 'control':78 'coordin':55 'current':23 'customiz':67 'delay':48 'develop':27 'differenti':62 'disrupt':22 'durat':39 'earli':26 'entri':44 'execut':81 'fine':76 'fine-grain':75 'flag':53 'focus':66 'frequent':29 'grain':77 'hook':56 'includ':63 'interact':21 'interactionmanag':61 'javascript':85 'level':41 'limit':88 'manag':13 'max':33 'minim':17 'nativ':59 'never':51 'never-cancel':50 'option':47 'order':82 'parallel':34 'per':43 'per-entri':42 'prioriti':40,72,91 'promis':86 'provid':54 'queue':5,9,90 'react':58 'releas':30 'run':4,8 'runafterinteract':68 'schedul':11,73 'side':20 'stat':69 'std':2 'std-client-run-queu':1 'support':31 'task':15,80 'throttl':89 'track':70 'typescript':7,92 'unit':36 'version':24 'via':60 'work':35,38","created_at":"2026-06-07T13:00:20.150722+00:00","updated_at":"2026-06-07T13:00:20.150722+00:00","problems":[{"fix":"Ensure proper import: import { RunQueue } from 'std-client-run-queue' and instantiate with new RunQueue('id').","cause":"RunQueue instance not created or imported incorrectly.","error":"TypeError: Cannot read properties of undefined (reading 'schedule')"},{"fix":"Use import { CANCELED } from 'std-client-run-queue'.","cause":"CANCELED symbol imported incorrectly or not imported.","error":"Error: CANCELED is not defined"},{"fix":"Provide a function that accepts (id: string, func: () => void) and returns a cancel function.","cause":"setRunAfterInteractions was called with an invalid function.","error":"TypeError: (intermediate value).runAfterInteractions is not a function"}],"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":null,"github":null,"docs":null,"changelog":null,"pypi":null,"npm":"std-client-run-queue","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"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}}