.. role:: clio-inherited
   :class: clio-flag clio-flag-inherited

.. role:: clio-readonly
   :class: clio-flag clio-flag-readonly


#############
UnsafePromise
#############

.. js:class:: wv.Util.UnsafePromise

   This represents a ``Promise`` that has its promised return value immediately available. The immediate value is unsafe to use (safety depends on specific use cases) until this ``UnsafePromise`` becomes marked as ready.
   
   The primary use case of this would be to synchronously return a reference to an object that needs to wait for an ``init(): Promise<void>`` function to complete.
   
   
   Index
   =====
   
   .. rubric:: Properties
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:data:`~wv.Util.UnsafePromise.[toStringTag]`
   * :js:data:`~wv.Util.UnsafePromise.isReady`
   * :js:data:`~wv.Util.UnsafePromise.readyPromise`
   * :js:data:`~wv.Util.UnsafePromise.unsafeValue`
   
   .. rubric:: Methods
   
   
   .. rst-class:: api-xref-list
   
   
   * :js:meth:`~wv.Util.UnsafePromise.catch`
   * :js:meth:`~wv.Util.UnsafePromise.finally`
   * :js:meth:`~wv.Util.UnsafePromise.then`
   
   



.. rst-class:: kind-group kind-properties

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


.. js:data:: wv.Util.UnsafePromise.[toStringTag]

      .. rst-class:: clio-flags
      
         :clio-readonly:`readonly`
         :clio-inherited:`inherited`
      
      .. rst-class:: sig-pretty-signature
      
         | [toStringTag]: *string*
      



.. js:data:: wv.Util.UnsafePromise.isReady

      .. rst-class:: sig-pretty-signature
      
         | isReady: *boolean*
      
      This value becomes ``true`` once ``this.readyPromise`` resolves. If ``this.readyPromise`` rejects, this value never becomes ``true``\ .
      



.. js:data:: wv.Util.UnsafePromise.readyPromise

      .. rst-class:: sig-pretty-signature
      
         | readyPromise: *Promise*
      
      This promise resolves once ``this.unsafeValue`` is safe to access.
      



.. js:data:: wv.Util.UnsafePromise.unsafeValue

      .. rst-class:: sig-pretty-signature
      
         | unsafeValue: T
      
      An unsafe synchronous reference to the value returned through this promise's ``then()`` callback.
      



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

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


.. js:method:: wv.Util.UnsafePromise.catch

      .. rst-class:: clio-flags
      
         :clio-inherited:`inherited`
      
      .. rst-class:: sig-pretty-signature
      
         | catch(**onrejected**\ : (*None* | (**reason**\ : *any*\ ) => (TResult | *PromiseLike*\ ))): *Promise*
      
      Attaches a callback for only the rejection of the Promise.
      
      **Parameters**
      
      
         **onrejected**\ : (*None* \| (**reason**\ : *any*\ ) => (TResult \| *PromiseLike*\ ))
      
      
            The callback to execute when the Promise is rejected.
      
      
      
      **Returns**\ : *Promise*
      
      
         A Promise for the completion of the callback.
      
      



.. js:method:: wv.Util.UnsafePromise.finally

      .. rst-class:: clio-flags
      
         :clio-inherited:`inherited`
      
      .. rst-class:: sig-pretty-signature
      
         | finally(**onfinally**\ : (*None* | () => *void*\ )): *Promise*
      
      Attaches a callback that is invoked when the Promise is settled (fulfilled or rejected). The resolved value cannot be modified from the callback.
      
      **Parameters**
      
      
         **onfinally**\ : (*None* \| () => *void*\ )
      
      
            The callback to execute when the Promise is settled (fulfilled or rejected).
      
      
      
      **Returns**\ : *Promise*
      
      
         A Promise for the completion of the callback.
      
      



.. js:method:: wv.Util.UnsafePromise.then

      .. rst-class:: clio-flags
      
         :clio-inherited:`inherited`
      
      .. rst-class:: sig-pretty-signature
      
         | then(**onfulfilled**\ : (*None* | (**value**\ : T) => (TResult1 | *PromiseLike*\ )), **onrejected**\ : (*None* | (**reason**\ : *any*\ ) => (TResult2 | *PromiseLike*\ ))): *Promise*
      
      Attaches callbacks for the resolution and/or rejection of the Promise.
      
      **Parameters**
      
      
         **onfulfilled**\ : (*None* \| (**value**\ : T) => (TResult1 \| *PromiseLike*\ ))
      
      
            The callback to execute when the Promise is resolved.
      
      
         **onrejected**\ : (*None* \| (**reason**\ : *any*\ ) => (TResult2 \| *PromiseLike*\ ))
      
      
            The callback to execute when the Promise is rejected.
      
      
      
      **Returns**\ : *Promise*
      
      
         A Promise for the completion of which ever callback is executed.
      
      




