Skip to content

Latest commit

 

History

History
131 lines (104 loc) · 2.54 KB

API.md

File metadata and controls

131 lines (104 loc) · 2.54 KB

promise-status-async API

Table of Contents

Constants

PromiseStatuses

{
    PROMISE_PENDING: "pending",
    PROMISE_RESOLVED: "resolved",
    PROMISE_REJECTED: "rejected"
}

Presents all the possible promise statuses.

PROMISE_PENDING

"pending"

Presents status name for pending promise.

PROMISE_RESOLVED

"resolved"

Presents status name for resolved promise.

PROMISE_REJECTED

"rejected"

Presents status name for rejected promise.

Functions

promiseStatus()

    async promiseStatus(
        promise: Promise
    ): string // PROMISE_PENDING | PROMISE_RESOLVED | PROMISE_REJECTED

Returns an actual status of the promise.

promiseState()

    async promiseState(
        promise: Promise
    ): {
        status: string, // PROMISE_PENDING | PROMISE_RESOLVED | PROMISE_REJECTED
        [value]: any,
        [reason]: any
    }

Describes actual state of the promise.

Predicates

isPromisePending()

    async isPromisePending(
        promise: Promise
    ): boolean

Tells whether promise is in pending status.

isPromiseResolved()

    async isPromiseResolved(
        promise: Promise
    ): boolean

Tells whether promise is in resolved status.

isPromiseRejected()

    async isPromiseRejected(
        promise: Promise
    ): boolean

Tells whether promise is in rejected status.

isPromiseNotPending()

    async isPromiseNotPending(
        promise: Promise
    ): boolean

Tells whether promise is in any status different to pending.

isPromiseNotResolved()

    async isPromiseNotResolved(
        promise: Promise
    ): boolean

Tells whether promise is in any status different to resolved.

isPromiseNotRejected()

    async isPromiseNotRejected(
        promise: Promise
    ): boolean

Tells whether promise is in any status different to rejected.