.. role:: ts-api-decorator

###########
OpenPromise
###########

.. js:module:: Util
   :noindex:

.. container:: ts-api-section

   .. js:class:: OpenPromise

      This represents a ``Promise`` that has its ``resolve`` and ``reject`` functions
      bundled as methods attached to the promise object.



.. container:: api-index-section

   .. rubric:: Properties

   .. rst-class:: api-index-list-item api-kind-property api-parent-kind-interface

   * :js:attr:`~Util.OpenPromise.[toStringTag]`



.. container:: api-index-section

   .. rubric:: Methods

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

   * :js:meth:`~Util.OpenPromise.catch`
   * :js:meth:`~Util.OpenPromise.finally`
   * :js:meth:`~Util.OpenPromise.reject`
   * :js:meth:`~Util.OpenPromise.resolve`
   * :js:meth:`~Util.OpenPromise.then`





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

Properties
==========

.. container:: ts-api-section

   .. js:attribute:: OpenPromise.[toStringTag]

      :type: string





Methods
=======

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

catch
-----

.. js:method:: OpenPromise.catch([ onrejected])

   :param onrejected: :ts-api-decorator:`optional` The callback to execute when the Promise is rejected.
   :type onrejected: null | function


   Attaches a callback for only the rejection of the Promise.

   :returns: A Promise for the completion of the callback.


   :rtype: Promise <T | TResult>




   .. js:function:: onrejected( reason)
      :noindex:

      :param reason: None
      :type reason: any


      :rtype: TResult | PromiseLike <TResult>



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

finally
-------

.. js:method:: OpenPromise.finally([ onfinally])

   :param onfinally: :ts-api-decorator:`optional` The callback to execute when the Promise is settled (fulfilled or rejected).
   :type onfinally: null | function


   Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The
   resolved value cannot be modified from the callback.

   :returns: A Promise for the completion of the callback.


   :rtype: Promise <T>




   .. js:function:: onfinally()
      :noindex:



      :rtype: void



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

reject
------

.. js:method:: OpenPromise.reject( error)

   :param error: None
   :type error: any


   :rtype: void

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

resolve
-------

.. js:method:: OpenPromise.resolve( this, value)

   :param this: None
   :type this: OpenPromise <T>
   :param value: None
   :type value: T | PromiseLike <T>


   :rtype: void

.. js:method:: OpenPromise.resolve( this)
   :noindex:

   :param this: None
   :type this: OpenPromise <void>


   :rtype: void

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

then
----

.. js:method:: OpenPromise.then([ onfulfilled[, onrejected]])

   :param onfulfilled: :ts-api-decorator:`optional` The callback to execute when the Promise is resolved.
   :type onfulfilled: null | function
   :param onrejected: :ts-api-decorator:`optional` The callback to execute when the Promise is rejected.
   :type onrejected: null | function


   Attaches callbacks for the resolution and/or rejection of the Promise.

   :returns: A Promise for the completion of which ever callback is executed.


   :rtype: Promise <TResult1 | TResult2>




   .. js:function:: onfulfilled( value)
      :noindex:

      :param value: None
      :type value: T


      :rtype: TResult1 | PromiseLike <TResult1>

   .. js:function:: onrejected( reason)
      :noindex:

      :param reason: None
      :type reason: any


      :rtype: TResult2 | PromiseLike <TResult2>



