Home > @rushstack/heft > CancellationTokenSource
CancellationTokenSource class
This API is provided as a preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
A cancellation token source. Produces cancellation tokens that can be used to signal that an ongoing process has either been cancelled or timed out.
Signature:
export declare class CancellationTokenSource
Remarks
This class will eventually be removed once the AbortController API is available in the lowest supported LTS version of Node.js. See here for more information: https://nodejs.org/docs/latest-v16.x/api/globals.html\#class-abortcontroller
Constructors
| Constructor | Modifiers | Description |
|---|---|---|
| (constructor)(options) | (BETA) Constructs a new instance of the CancellationTokenSource class |
Properties
| Property | Modifiers | Type | Description |
|---|---|---|---|
| isCancelled | readonly | boolean | (BETA) Whether or not the token has been cancelled. |
| token | readonly | CancellationToken | (BETA) Obtain the cancellation token produced by this source. |
Methods
| Method | Modifiers | Description |
|---|---|---|
| cancel() | (BETA) Cancel the token provided by the source. |