Home > @i2analyze/notebook-sdk > app > ICancelation
app.ICancelation interface
A collection of methods and properties for handling the situation when a user cancels an operation.
Signature:
interface ICancelation
Introduced: version 1.1
Remarks
The i2 Notebook SDK provides two cancelation APIs: An AbortSignal-based API and a Promise-based API, which you can use depending on your scenario:
To launch an asynchronous operation (for example, a
fetchcall) that can itself be canceled by anAbortSignal, you can passsignaldirectly to that operation.To launch an asynchronous operation that cannot itself be canceled but is to be abandoned if the user requests cancelation, call
waitForPromiseOrCancel()with thePromisefrom your operation. The returnedPromiseresolves or rejects just as your operation'sPromisedoes, and it rejects immediately with anAbortErrorif the user cancels the operation.
To check synchronously if the operation has been canceled, you can inspect the signal.aborted property.
Properties
| Property | Modifiers | Type | Description |
|---|---|---|---|
| signal | AbortSignal | Gets an AbortSignal that indicates whether a user has requested that an operation be canceled. |
Methods
| Method | Description |
|---|---|
| waitForPromiseOrCancel(promise) | Launches an asynchronous operation through the specified promise. |