# CancelablePromise | windmill-client
Documentation for windmill-client

# Class CancelablePromise<T>

#### Type Parameters

- T

#### Implements

- Promise< T >

- Defined in src/core/CancelablePromise.ts:20

#####
Index

### Accessors

[toStringTag]
isCancelled

### Constructors

constructor

### Methods

cancel
catch
finally
then

### Properties

cancelHandlers
promise

##
Accessors

### [toStringTag]

- get [toStringTag](): string

- #### Returns string

  Implementation of Promise.[toStringTag]

  - Defined in src/core/CancelablePromise.ts:83

### isCancelled

- get isCancelled(): boolean

- #### Returns boolean

  - Defined in src/core/CancelablePromise.ts:123

##
Constructors

### constructor

- new CancelablePromise< T >(executor): CancelablePromise < T >

- #### Type Parameters

  - T

  #### Parameters

  - executor: ((resolve: ((value: T | PromiseLike< T >) => void), reject: ((reason?: unknown) => void), onCancel: OnCancel) => void)
    - - (resolve, reject, onCancel): void

      - #### Parameters

        - resolve: ((value: T | PromiseLike< T >) => void)
          - - (value): void

            - #### Parameters

              - value: T | PromiseLike< T >

              #### Returns void

        - reject: ((reason?: unknown) => void)
          - - (reason?): void

            - #### Parameters

              - `Optional` reason: unknown

              #### Returns void

        - onCancel: OnCancel

        #### Returns void

  #### Returns CancelablePromise < T >

  - Defined in src/core/CancelablePromise.ts:29

##
Methods

### cancel

- cancel(): void

- #### Returns void

  - Defined in src/core/CancelablePromise.ts:104

### catch

- catch< TResult >(onRejected?): Promise< T | TResult >

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

  #### Type Parameters

  - TResult = never

  #### Parameters

  - `Optional` onRejected: null | ((reason: unknown) => TResult | PromiseLike< TResult >)

  #### Returns Promise< T | TResult >

  A Promise for the completion of the callback.

  Implementation of Promise.catch

  - Defined in src/core/CancelablePromise.ts:94

### finally

- finally(onFinally?): Promise< T >

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

  #### Parameters

  - `Optional` onFinally: null | (() => void)

  #### Returns Promise< T >

  A Promise for the completion of the callback.

  Implementation of Promise.finally

  - Defined in src/core/CancelablePromise.ts:100

### then

- then< TResult1 , TResult2 >(onFulfilled?, onRejected?): Promise< TResult1 | TResult2 >

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

  #### Type Parameters

  - TResult1 = T
  - TResult2 = never

  #### Parameters

  - `Optional` onFulfilled: null | ((value: T ) => TResult1 | PromiseLike< TResult1 >)
  - `Optional` onRejected: null | ((reason: unknown) => TResult2 | PromiseLike< TResult2 >)

  #### Returns Promise< TResult1 | TResult2 >

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

  Implementation of Promise.then

  - Defined in src/core/CancelablePromise.ts:87

##
Properties

### `Readonly` cancelHandlers

cancelHandlers: (() => void)[]

- Defined in src/core/CancelablePromise.ts:24

### `Readonly` promise

promise: Promise< T >

- Defined in src/core/CancelablePromise.ts:25