[]
        
(Showing Draft Content)

ReportViewer.CancellationToken

Class: CancellationToken

ReportViewer.CancellationToken

Represents a cancellation token.

example

const { token, cancel } = CancellationToken.create();
cancel('Stopped by user');

Table of contents

Properties

Accessors

Methods

Properties

parentToken

Optional Readonly parentToken: CancellationToken

Gets the parent token, if any.

Accessors

isCancellationRequested

get isCancellationRequested(): boolean

Gets a value indicating whether cancellation is requested.

Returns

boolean


promise

get promise(): Promise<any>

Gets a promise that resolves when cancellation is requested.

Returns

Promise<any>

Methods

register

register(callback): void

Registers a cancellation handler.

example

token.register((reason) => console.log(reason));

Parameters

Name Type Description
callback (reason: any) => any The callback invoked when cancellation is requested.

Returns

void


create

Static create(parentToken?): Object

Creates a cancellation token and cancel callback.

example

const { token, cancel } = CancellationToken.create();
cancel(new Error('Cancelled'));

Parameters

Name Type Description
parentToken? CancellationToken The optional parent token to link cancellation.

Returns

Object

The token and a function that triggers cancellation.

Name Type
token CancellationToken
cancel (e: any) => void