@salesforce/apex-node
Version:
Salesforce JS library for Apex
33 lines (32 loc) • 1.04 kB
TypeScript
/**
* The following definitions are adapted from Type Definition for Visual Studio Code 1.46 Extension API
* See https://code.visualstudio.com/api for more information
*/
/**
* A cancellation token is passed to an asynchronous or long running
* operation to request cancellation, like cancelling a request
* for completion items because the user continued to type.
*
* To get an instance of a `CancellationToken` use a
* [CancellationTokenSource](#CancellationTokenSource).
*/
export interface CancellationToken {
/**
* Is `true` when the token has been cancelled, `false` otherwise.
*/
isCancellationRequested: boolean;
/**
* An event which fires upon cancellation.
*/
onCancellationRequested: Function;
}
declare class Token implements CancellationToken {
isCancellationRequested: boolean;
callbacks: Function[];
onCancellationRequested(listener: Function): void;
}
export declare class CancellationTokenSource {
token: Token;
asyncCancel(): Promise<void>;
}
export {};