Overview
A queue composable for managing time-based collections with automatic timeout-based removal, pause/resume functionality, and FIFO ordering. Built on top ofcreateRegistry, the queue automatically manages timeouts for tickets and ensures only the first ticket in the queue is active at any time.
Basic Usage
Function Signature
Parameters
Configuration options for the queue
Default timeout in milliseconds for tickets without explicit timeout
Returns
Queue context with methods and properties
Register a new ticket in the queue. Returns the registered ticket with
dismiss() method.Remove a ticket by ID. If no ID provided, removes the first ticket.
Pause the timeout of the first ticket in the queue
Resume the timeout of the first paused ticket
Remove all tickets and clear all timeouts
Batch unregister multiple tickets by ID array
Current number of tickets in the queue
Timeout Behavior
Default Timeout
Tickets use the default timeout from queue options if not specified:Custom Timeout
Override timeout per ticket:Persistent Tickets
Use-1 to prevent automatic removal:
Queue Progression
Only the first ticket’s timeout is active. When removed, the next ticket automatically becomes active:Pause and Resume
Control timeout progression:Context Pattern
Use dependency injection for global queue access:TypeScript
Custom Ticket Types
Extend ticket properties:Related
- createRegistry - Base registry primitive
- createTimeline - Undo/redo with bounded history