Class: PromiseQueue<T>
A promise queue contains any number of QueuePromise objects. These objects are stored within a PromiseQueue and executed as quickly as possible in order. This is ideal in situations where a specific operation should be applied in an ordered way while still making.
Type Parameters
T
T extends QueueablePromise
Constructors
Constructor
new PromiseQueue<
T>(queueMaxSize?,enabled?):PromiseQueue<T>
Constructs a new promise queue.
Parameters
queueMaxSize?
number
An optional maximum size, when the max size is hit. The older promises will be discarded.
enabled?
boolean = true
When false, the queue will not process any jobs. Assign enabled to true to start processing.
Returns
PromiseQueue<T>
Accessors
enabled
Get Signature
get enabled():
boolean
Returns
boolean
Set Signature
set enabled(
value):void
Enable or disable the queue. When disabled, the queue will not process any jobs. Disabling processing will not cancel any active promises.
Parameters
value
boolean
Returns
void
Methods
enqueue()
enqueue(
promise):void
Enqueue a new promise.
Parameters
promise
T
A new promise to add to the queue.
Returns
void
finalize()
finalize():
Promise<void>
Finalize the queue, any jobs that come in while this is in progress will result in the promise being extended.
Returns
Promise<void>
getRemainingQueueSize()
getRemainingQueueSize():
number
Returns
number
The number of unexecuted jobs remaining in the queue. Not including the active job.
hasActivePromise()
hasActivePromise():
boolean
Returns
boolean
Returns true when work is being actively processed by this queue.