@aracna/core - v1.5.0
    Preparing search index...

    Class DeferredPromise<T>

    The DeferredPromise class is built on top of the native Promise class. It provides a way to resolve or reject a promise from the outside.

    Aracna Reference

    Type Parameters

    • T
    Index

    Constructors

    Properties

    _reject: (reason?: any) => void
    _resolve: (value: T | PromiseLike<T>) => void
    instance: Promise<T>

    The native promise instance.

    reason?: any

    The reason for the rejection of the promise.

    The state of the promise, can be pending, fulfilled or rejected.

    value?: T

    The value of the resolved promise.

    Accessors

    Methods

    • Attaches a callback for only the rejection of the Promise.

      Type Parameters

      • TResult = never

      Parameters

      • Optionalonrejected: ((reason: any) => TResult | PromiseLike<TResult>) | null

        The callback to execute when the Promise is rejected.

      Returns this

      A Promise for the completion of the callback.

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

      Parameters

      • Optionalonfinally: (() => void) | null

        The callback to execute when the Promise is settled (fulfilled or rejected).

      Returns this

      A Promise for the completion of the callback.

    • Resolves the promise with a value or the result of another promise.

      Parameters

      • value: T | PromiseLike<T>

      Returns void

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

      Type Parameters

      • TResult1 = T
      • TResult2 = never

      Parameters

      • Optionalonfulfilled: ((value: T) => TResult1 | PromiseLike<TResult1>) | null

        The callback to execute when the Promise is resolved.

      • Optionalonrejected: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null

        The callback to execute when the Promise is rejected.

      Returns this

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