Rush StackShopBlogEvents
Skip to main content

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

ConstructorModifiersDescription
(constructor)(options)(BETA) Constructs a new instance of the CancellationTokenSource class

Properties

PropertyModifiersTypeDescription
isCancelledreadonlyboolean(BETA) Whether or not the token has been cancelled.
tokenreadonlyCancellationToken(BETA) Obtain the cancellation token produced by this source.

Methods

MethodModifiersDescription
cancel()(BETA) Cancel the token provided by the source.