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.