.. role:: ts-api-decorator

###########
ActionQueue
###########

.. js:module:: Util
   :noindex:

.. container:: ts-api-section

   .. js:class:: ActionQueue

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



.. container:: api-index-section

   .. rubric:: Constructors

   .. rst-class:: api-index-list-item api-kind-constructor api-parent-kind-class

   * :js:meth:`~Util.ActionQueue.constructor`



.. container:: api-index-section

   .. rubric:: Methods

   .. rst-class:: api-index-list-item api-kind-method api-parent-kind-class

   * :js:meth:`~Util.ActionQueue.isIdle`
   * :js:meth:`~Util.ActionQueue.push`
   * :js:meth:`~Util.ActionQueue.waitForIdle`





------------

Constructors
============

.. container:: ts-api-section

   .. js:function:: ActionQueue.constructor( maxActivePromises, suppressFailures)

      :param maxActivePromises: Max number of promises to leave open before they begin getting deferred
      :type maxActivePromises: number
      :param suppressFailures: Whether or not rejected promises and actions that throw cause the queue to fail
      :type suppressFailures: boolean


      Creates a new [ActionQueue]


      :rtype: ActionQueue



Methods
=======

.. rst-class:: ts-api-section

isIdle
------

.. js:method:: ActionQueue.isIdle()



   Returns ``true`` if there are no actions waiting to be evaluated

   :returns: Boolean indicating idle status


   :rtype: boolean

.. rst-class:: ts-api-section

push
----

.. js:method:: ActionQueue.push( action)

   :param action: None
   :type action: ActionLike


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


   :rtype: void

.. rst-class:: ts-api-section

waitForIdle
-----------

.. js:method:: 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

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


   :rtype: Promise <void>

