The number of queued items waiting to run.
The number of items currently running.
Size of the queue including running items
Abort all jobs in the queue and clear it
Adds a sync or async task to the queue. Always returns a promise.
Optionaloptions: JobOptionsThe addEventListener() method of the EventTarget interface sets up a function that will be called whenever the specified event is delivered to the target.
Optionaloptions: boolean | AddEventListenerOptionsClear the queue
The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().
The dispatchEvent() method of the EventTarget sends an Event to the object, (synchronously) invoking the affected event listeners in the appropriate order. The normal event processing rules (including the capturing and optional bubbling phase) also apply to events dispatched manually with dispatchEvent().
Can be called multiple times. Useful if you for example add additional items at a later time.
Optionaloptions: AbortOptionsA promise that settles when the queue becomes empty.
The difference with .onEmpty is that .onIdle guarantees that all work
from the queue has finished. .onEmpty merely signals that the queue is
empty, but it could mean that some promises haven't completed yet.
Optionaloptions: AbortOptionsA promise that settles when the queue becomes empty, and all
promises have completed; queue.size === 0 && queue.pending === 0.
Optionaloptions: AbortOptionsA promise that settles when the queue size is less than the given
limit: queue.size < limit.
If you want to avoid having the queue grow beyond a certain size you can
await queue.onSizeLessThan() before adding a new item.
Note that this only limits the number of items waiting to start. There
could still be up to concurrency jobs already running that this call does
not include in its calculation.
Prevent further jobs from running - call .start to start the queue again
The removeEventListener() method of the EventTarget interface removes an event listener previously registered with EventTarget.addEventListener() from the target. The event listener to be removed is identified using a combination of the event type, the event listener function itself, and various optional options that may affect the matching process; see Matching event listeners for removal.
Optionallistener: EventHandler<QueueEvents<JobReturnType, JobOptions>[K]> | nullOptionaloptions: boolean | EventListenerOptionsOptionaldetail: CustomEventInit<Detail>Start the queue. If the autoStart parameter passed to the constructor was
not false this is a no-op
Returns an async generator that makes it easy to iterate over the results of jobs added to the queue.
The generator will end when the queue becomes idle, that is there are no jobs running and no jobs that have yet to run.
If you need to keep the queue open indefinitely, consider using it-pushable instead.
Optionaloptions: AbortOptions
Heavily influence by
p-queuewith the following differences:queue.sizeincludesqueue.pendingitems - this is so interested parties can join the results of a queue item while it is running