@grapecity/gcpdfviewer
Version:
GcDocs PDF Viewer
37 lines (36 loc) • 1.06 kB
TypeScript
/**
* @module Viewer
* Provies a facility to trigger and handle cancellation requests.
*/
/**
* Cancellation token.
*/
export declare class CancellationToken {
private _isCancellationRequested;
private _cancellationPromise;
private _cancel;
/** The parent token */
readonly parentToken?: CancellationToken;
private constructor();
/**
* Creates a cancellation token and trigger function.
* @param parentToken The parent token.
*/
static create(parentToken?: CancellationToken): {
token: CancellationToken;
cancel: (e: any) => void;
};
/**
* Gets true if cancellation is being requested.
*/
get isCancellationRequested(): boolean;
/**
* Gets a promise that is triggered when cancellation is requested.
*/
get promise(): Promise<any>;
/**
* Registers a new cancellation handler. Handler is invoked when cancellation is requested.
* @param callback
*/
register(callback: (reason: any) => any): void;
}