A ticket-based FIFO queue for Node.js (v24+), Bun, and Deno. Unlike traditional mutexes or single-blocking acquire, it allows non-blocking ticket acquisition, then later blocking until the ticket is first in line. Uses Explicit Resource Management (Disposable) for automatic cleanup. v0.2.1, ESM-only, TypeScript-types included. Differentiator: tickets can be acquired early, allowing parallel work before serializing order.
npm install ticket-queueNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a TicketQueue and demonstrates non-blocking ticket acquisition with FIFO ordering and automatic disposal via Explicit Resource Management (`using`).
Upgrade to Node.js >= v24 or manually call `ticket[Symbol.dispose]()` in a finally block after every acquireTicket().
Always use `using` (preferred) or wrap acquireTicket() in try/finally with ticket[Symbol.dispose]() or waitForFirstAndRemove().
Use `using ticket = tq.acquireTicket(); await tq.waitForFirst(ticket);` and let disposal happen automatically.
Use `import` syntax or dynamic `import('ticket-queue').then(...)`. For Node <16, upgrade or use bundler.Each runtime context (e.g., worker thread) must create its own TicketQueue instance.
Change to `import { TicketQueue } from 'ticket-queue'` or use dynamic import.Upgrade to Node >=24 or use try/finally with `ticket[Symbol.dispose]?.()` or manual queue removal.
Ensure every acquireTicket() is paired with disposal: preferably `using` or explicit `ticket[Symbol.dispose]()` in a finally block.
Use `import type { Ticket } from 'ticket-queue'`.No dependency data recorded yet.