神岛 API 文档 - ArenaPro版
    Preparing search index...

    Interface Promise<T>

    Represents the completion of an asynchronous operation

    interface Promise<T> {
        "[toStringTag]": string;
        catch<TResult = never>(
            onrejected?: (reason: any) => TResult | PromiseLike<TResult>,
        ): Promise<T | TResult>;
        catch<TResult = never>(
            onrejected?: (reason: any) => TResult | PromiseLike<TResult>,
        ): Promise<T | TResult>;
        finally(onfinally?: () => void): Promise<T>;
        finally(onfinally?: () => void): Promise<T>;
        then<TResult1 = T, TResult2 = never>(
            onfulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>,
            onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>,
        ): Promise<TResult1 | TResult2>;
        then<TResult1 = T, TResult2 = never>(
            onfulfilled?: (value: T) => TResult1 | PromiseLike<TResult1>,
            onrejected?: (reason: any) => TResult2 | PromiseLike<TResult2>,
        ): Promise<TResult1 | TResult2>;
    }

    Type Parameters

    • T
    Index

    Properties

    Methods

    Properties

    "[toStringTag]": string

    一个字符串值,用于创建对象的默认字符串描述。由内置方法 Object.prototype.toString 调用。

    A String value that is used in the creation of the default string description of an object. Called by the built-in method Object.prototype.toString.

    Methods

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

      Type Parameters

      • TResult = never

      Parameters

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

        The callback to execute when the Promise is rejected.

      Returns Promise<T | TResult>

      A Promise for the completion of the callback.

    • Type Parameters

      • TResult = never

      Parameters

      Returns Promise<T | TResult>

      仅为 Promise 的拒绝附加回调。

      Attaches a callback for only the rejection of the Promise.

      当 Promise 被拒绝时执行的回调。

      The callback to execute when the Promise is rejected.

      一个用于完成回调的 Promise。

      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

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

      Returns Promise<T>

      A Promise for the completion of the callback.

    • Parameters

      • Optionalonfinally: () => void

      Returns Promise<T>

      附加一个在 Promise 敲定(无论是 fulfilled 或 rejected)时调用的回调函数。从该回调中无法修改解析值。

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

      当 Promise 敲定时要执行的回调函数。

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

      一个表示回调完成的 Promise。

      A Promise for the completion of the callback.

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

      Type Parameters

      • TResult1 = T
      • TResult2 = never

      Parameters

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

        The callback to execute when the Promise is resolved.

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

        The callback to execute when the Promise is rejected.

      Returns Promise<TResult1 | TResult2>

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

    • Type Parameters

      • TResult1 = T
      • TResult2 = never

      Parameters

      Returns Promise<TResult1 | TResult2>

      为 Promise 的解决和/或拒绝附加回调。

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

      当 Promise 解决时执行的回调。

      The callback to execute when the Promise is resolved.

      当 Promise 被拒绝时执行的回调。

      The callback to execute when the Promise is rejected.

      一个 Promise,用于完成所执行的任何回调。

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