[]
ReportViewer.CancellationToken
Represents a cancellation token.
example
const { token, cancel } = CancellationToken.create();
cancel('Stopped by user');
• Optional Readonly parentToken: CancellationToken
Gets the parent token, if any.
• get isCancellationRequested(): boolean
Gets a value indicating whether cancellation is requested.
boolean
• get promise(): Promise<any>
Gets a promise that resolves when cancellation is requested.
Promise<any>
▸ register(callback): void
Registers a cancellation handler.
example
token.register((reason) => console.log(reason));
| Name | Type | Description |
|---|---|---|
callback |
(reason: any) => any |
The callback invoked when cancellation is requested. |
void
▸ Static create(parentToken?): Object
Creates a cancellation token and cancel callback.
example
const { token, cancel } = CancellationToken.create();
cancel(new Error('Cancelled'));
| Name | Type | Description |
|---|---|---|
parentToken? |
CancellationToken |
The optional parent token to link cancellation. |
Object
The token and a function that triggers cancellation.
| Name | Type |
|---|---|
token |
CancellationToken |
cancel |
(e: any) => void |