Dequeues the next item from the queue and returns a promise that resolves to it. If the queue is empty, it creates a new promise that will be resolved when an item is enqueued.
Promise
Adds an item to the queue. If there are pending dequeued promises, it resolves the oldest promise with the enqueued item immediately; otherwise, it adds the item to the queue.
The item to be added to the queue.
Determine whether the queue has been cancelled.
boolean - Returns true if the queue is cancelled, otherwise false.
Determine whether the queue is empty.
boolean - Returns true if the queue has no elements, otherwise false.
Retrieve the length of the pending dequeue.
number - The number of items currently in the pending dequeue.
Cancels all pending promises in the queue and rejects them with an AsyncQueueCancelledError. This ensures that any awaiting code can handle the cancellation appropriately.