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.