Skip to main content

CancellationToken

FitFileViewer - API Documentation v30.0.1


FitFileViewer - API Documentation / utils/app/async/cancellationToken / CancellationToken

Class: CancellationToken

Defined in: utils/app/async/cancellationToken.ts:16

Cancellation token for async operations.

Constructors​

Constructor​

new CancellationToken(): CancellationToken

Returns​

CancellationToken

Properties​

_isCancelled​

private _isCancelled: boolean = false

Defined in: utils/app/async/cancellationToken.ts:17


_listeners​

private _listeners: () => void[] = []

Defined in: utils/app/async/cancellationToken.ts:18

Returns​

void

Accessors​

isCancelled​

Get Signature​

get isCancelled(): boolean

Defined in: utils/app/async/cancellationToken.ts:23

Check if operation is cancelled.

Returns​

boolean

Methods​

cancel()​

cancel(): void

Defined in: utils/app/async/cancellationToken.ts:30

Cancel the operation.

Returns​

void


onCancel()​

onCancel(listener: () => void): () => void

Defined in: utils/app/async/cancellationToken.ts:61

Register a listener to be called when cancelled.

Parameters​

listener​

() => void

Listener function.

Returns​

Unsubscribe function.

() => void

Throws​

TypeError when listener is not a function.


throwIfCancelled()​

throwIfCancelled(): void

Defined in: utils/app/async/cancellationToken.ts:95

Throw if cancelled.

Returns​

void

Throws​

Error when the operation is cancelled.