
#####
Timer
#####

.. js:class:: Util.Timer

   This class represents a single time-delayed action.
   
   
   Index
   =====
   
   .. rubric:: Constructors
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:func:`~Util.Timer.constructor`
   
   .. rubric:: Methods
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:meth:`~Util.Timer.clear`
   * :js:meth:`~Util.Timer.isIdle`
   * :js:meth:`~Util.Timer.set`
   * :js:meth:`~Util.Timer.waitForIdle`
   
   




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

.. js:method:: Util.Timer.constructor

   .. rst-class:: sig-pretty-signature
   
      | Timer(): :js:class:`Timer <Util.Timer>`
   
   **Returns**\ : :js:class:`Timer <Util.Timer>`
   





Methods
=======

.. js:method:: Util.Timer.clear

   .. rst-class:: sig-pretty-signature
   
      | clear(): *void*
   
   Clears the pending action if it exists.
   
   **Returns**\ : *void*
   



.. js:method:: Util.Timer.isIdle

   .. rst-class:: sig-pretty-signature
   
      | isIdle(**type**\ : :js:data:`TimerIdleType <Util.TimerIdleType>`\ ): *boolean*
   
   Returns true if no pending action exists and false otherwise.
   
   **Parameters**
   
      **type**\ : :js:data:`TimerIdleType <Util.TimerIdleType>`
   
   
   **Returns**\ : *boolean*
   



.. js:method:: Util.Timer.set

   .. rst-class:: sig-pretty-signature
   
      | set(**delay**\ : *number*\ , **action**\ : () => *void*\ ): *void*
   
   Sets a new delayed action. If one is already pending before this call is made, it gets cleared.
   
   **Parameters**
   
      **delay**\ : *number*
   
         The delay in milliseconds to pend the action.
   
   
      **action**\ : () => *void*
   
         The action to pend.
   
   
   
   **Returns**\ : *void*
   



.. js:method:: Util.Timer.waitForIdle

   .. rst-class:: sig-pretty-signature
   
      | waitForIdle(**type**\ : :js:data:`TimerIdleType <Util.TimerIdleType>`\ ): *Promise*
   
   Returns a promise that resolves when the timer becomes (or already is) idle.
   
   **Parameters**
   
      **type**\ : :js:data:`TimerIdleType <Util.TimerIdleType>`
   
   
   **Returns**\ : *Promise*
   





