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
fetch
call) that can itself be canceled by anAbortSignal
, you can passsignal
directly 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 thePromise
from your operation. The returnedPromise
resolves or rejects just as your operation'sPromise
does, and it rejects immediately with anAbortError
if 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. |