
#####
Timer
#####

.. js:class:: wv.Util.Timer

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



.. rst-class:: kind-group kind-constructors

.. rubric:: Constructors
   :class: kind-group-title


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

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



.. rst-class:: kind-group kind-methods

.. rubric:: Methods
   :class: kind-group-title


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

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



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

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



.. js:method:: wv.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:: wv.Util.Timer.waitForIdle

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




