ActionQueue

class Communicator.Util.ActionQueue()

A queue of [Action]s to be evaluated. Some number of actions are allowed to be active at once Settable via the constructor.

Constructors


Constructors

ActionQueue.constructor(maxActivePromises, suppressFailures)

Creates a new [ActionQueue]

Arguments
  • maxActivePromises (number()) –

  • suppressFailures (boolean()) –

Return type

ActionQueue()

Methods

isIdle

ActionQueue.isIdle()

Returns true if there are no actions waiting to be evaluated

Return type

boolean

Returns

Boolean indicating idle status

push

ActionQueue.push(action)

Pushes a new [ActionLike] to be evaluated onto the queue

Arguments
Return type

void

waitForIdle

ActionQueue.waitForIdle()

Returns a Promise<void> that resolves when all actions have been completed or rejects if there was a failure

It should be noted that if the queue is configured not to suppress failures and an action throws an error, any deferred actions (actions that were queued but not active at the time of the failure) will be cleared from the queue and will not be evaluated

Return type

Promise <void>

Returns

A promise that resolves/rejects when all actions have been completed

It should be noted that if the queue is configured not to suppress failures and an action throws an error, any deferred actions (actions that were queued but not active at the time of the failure) will be cleared from the queue and will not be evaluated