import { default } from "https://deno.land/x/p_queue@1.0.1/mod.ts";
Promise queue with concurrency control.
Constructors
Returns a new queue
instance, which is an EventTarget
(https://developer.mozilla.org/en-US/docs/Web/API/EventTarget) subclass.
Type Parameters
Properties
Methods
Adds a sync or async task to the queue. Always returns a promise.
Same as .add()
, but accepts an array of sync or async functions.
Can be called multiple times. Useful if you for example add additional items at a later time.
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.
Size of the queue, filtered by the given options. For example, this can be used to find the number of items remaining in the queue with a specific priority level.
Start (or resume) executing enqueued tasks within concurrency limit. No
need to call this if queue is not paused (via options.autoStart = false
or by .pause()
method.)